/* SERDEC WordPress theme adjustments: use existing SERDEC illustrations and visual vocabulary. */
:root {--sa-turquoise:#23ab82}
body.admin-bar .site-header{top:32px}
@media(max-width:782px){body.admin-bar .site-header{top:46px}}
body{overflow-x:hidden}
.subject-grid.academy-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:25px}
.academy-grid .subject-card{min-width:0;background:#fff;border:1px solid #f1f3f1;border-radius:25px;box-shadow:0 14px 38px rgba(25,56,72,.09);overflow:hidden;transition:transform .24s,box-shadow .24s}
.academy-grid .subject-card:hover{transform:translateY(-7px);box-shadow:0 20px 46px rgba(25,56,72,.15)}
.academy-grid .subject-image{height:206px;position:relative;overflow:hidden;background:var(--soft)}
.academy-grid .subject-image img{width:100%;height:100%;object-fit:cover;transition:transform .4s}
.academy-grid .subject-card:hover img{transform:scale(1.045)}
.academy-grid .subject-emoji{position:absolute;right:12px;top:12px;font-size:25px;border:3px solid white;background:rgba(255,255,255,.94);border-radius:15px;min-width:49px;height:49px;display:grid;place-items:center}
.academy-grid .subject-body{padding:25px 25px 20px}
.academy-grid .subject-body h3{font-size:23px;line-height:1.25;margin:9px 0 10px;color:#18364c}
.academy-grid .subject-body p{font-size:14px;line-height:1.7;min-height:48px;color:#68808b;margin:0 0 22px}
.academy-grid .subject-category{font-size:10px;letter-spacing:1px;font-weight:900;color:#1d9d7b}
.academy-grid .subject-footer{display:flex;justify-content:space-between;align-items:center;gap:9px;padding-top:14px;border-top:1px solid #eef2f0}
.academy-grid .subject-check{font-size:11px;font-weight:900;color:#5b8f7b}
.academy-grid .round-arrow{border:0;background:#def6ed;color:#168c6f;width:46px;height:46px;border-radius:16px;font-size:24px;font-weight:900;cursor:pointer;transition:.2s}
.academy-grid .round-arrow:hover{background:#2cae86;color:white;transform:rotate(12deg)}
.section-heading h2{font-size:clamp(30px,4vw,52px);margin:10px 0 12px;letter-spacing:-1.6px;color:#17334e;line-height:1.18}
.section-heading h2 span{color:#20a781}
.section-heading p{color:#637987;margin:0}
.section-heading-sticker{font-size:58px;transform:rotate(6deg)}
.sa-consent{display:flex;align-items:flex-start;gap:10px;font-size:13px;font-weight:750;line-height:1.6;margin:15px 0;cursor:pointer}
.sa-consent input{margin-top:4px;min-width:18px;min-height:18px}
.sa-honeypot{position:absolute!important;left:-9000px!important;width:1px!important;height:1px!important;opacity:0}
.form-message{background:#fef5d6;padding:12px;border-radius:10px;color:#4e4f33;font-size:13px;margin-top:10px}
.form-message.hidden{display:none}
.auth-note a{text-decoration:underline;color:#168f72}
.mobile-menu.open{display:flex;flex-direction:column;padding:20px 26px;background:#fff;box-shadow:0 15px 30px #d3e7e340;gap:6px}
.mobile-menu a,.mobile-menu button{display:block;text-align:left;padding:12px 14px;background:#f0f9f4;color:#1a4252;border:0;border-radius:12px;font-weight:900}
.toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%,130px);padding:13px 20px;border-radius:14px;background:#12394a;color:white;box-shadow:0 16px 35px #092b3b33;z-index:900;opacity:0;transition:.25s;max-width:min(440px,90vw);font-size:14px;text-align:center}
.toast.visible{transform:translate(-50%,0);opacity:1}
.sa-page-content{padding-top:70px;padding-bottom:100px;min-height:60vh}
.sa-page-content .sa-post{background:#fff;padding:30px;border-radius:24px;margin:22px 0;box-shadow:0 9px 30px #182e4a0d}
.sa-page-content .sa-post a{text-decoration:underline}
#authOverlay .modal{max-height:90vh;overflow-y:auto}
#player .player-bar{position:relative;z-index:1}
#player #bookFrame{width:100%;height:100%;min-height:0;border:0;background:white;flex:1}
.player-actions button{cursor:pointer}
.player-actions .complete-btn:disabled{opacity:.6;cursor:not-allowed}
.player.hidden,.overlay.hidden,.celebration.hidden{display:none!important}
#celebration{z-index:700}
#bookFrame:fullscreen{height:100vh;width:100vw;background:white}
@media(max-width:1060px){.subject-grid.academy-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.section-heading-sticker{display:none}}
@media(max-width:700px){.subject-grid.academy-grid{grid-template-columns:1fr}.academy-grid .subject-image{height:210px}.academy-grid .subject-body p{min-height:0}.subject-grid{gap:17px}.mobile-toggle{display:flex}.site-header{height:74px}.nav-links,.nav-actions{display:none}.nav-shell{justify-content:space-between}.hero-grid{grid-template-columns:1fr}.hero-copy{padding-top:16px}.hero-art{min-height:380px}.central-frame{height:250px}.secondary-frame{height:130px}.tag-bottom{bottom:3%}.section-pad{padding:55px 0}.dash-stats{grid-template-columns:1fr}.dash-welcome{flex-wrap:wrap}.dash-heading h2{font-size:25px}.dash-actions{flex-wrap:wrap}.mini-ribbon{flex-wrap:wrap;justify-content:center}.mini-ribbon i{display:none}.hero h1{letter-spacing:-1.6px}.player-bar{display:flex!important;flex-wrap:wrap;justify-content:space-between}.player-middle{display:none}.player-actions .desktop-label{display:none}.auth-form .field-row{display:grid;grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}}

/* SERDEC shop integration */
.subject-footer a.round-arrow{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;flex-shrink:0}
.subject-footer .subject-check{font-weight:800}
@media(max-width:700px){.subject-footer .subject-check{font-size:12px}}

/* Book-card usability: activate same action from anywhere on its surface. */
.subject-grid .subject-card-clickable{cursor:pointer}
.subject-grid .subject-card-clickable:focus-visible{outline:4px solid #139c80;outline-offset:5px}
.academy-grid .round-arrow.book-unavailable{display:inline-flex;align-items:center;justify-content:center;background:#f1f5f9;color:#778b9a;cursor:default;transform:none;user-select:none}

/* Fix logged-in admin bar overlap on embedded book player */
body.admin-bar .player{top:32px;height:calc(100vh - 32px)}
@media(max-width:782px){body.admin-bar .player{top:46px;height:calc(100vh - 46px)}}

/* SERDEC Academy 3.1: calm child-friendly layout and readable book toolbar */
:root{--sa-kid-green:#139c75;--sa-kid-navy:#143a56}
.site-header .nav-links{gap:12px}
.site-header .nav-link{font-size:15px;padding:13px 17px}
.site-header .nav-link:hover{background:#dff7ed}
.hero{padding-top:32px}.hero-grid{min-height:490px}.hero-art{min-height:490px}
.subjects-section{padding-top:56px}.academy-grid .subject-card{border:2px solid #e3f1ee;box-shadow:0 8px 22px #14395412}
.academy-grid .subject-body h3{font-size:25px}.academy-grid .subject-body p{font-size:15px;min-height:38px}
.academy-grid .round-arrow{width:58px;height:58px;border-radius:20px;font-size:30px}
.sa-page-content .sa-post{padding:26px 30px}
.sa-page-content .sa-post h1{font-size:clamp(27px,4vw,43px);margin-top:0}
.sa-page-content .sa-post:has(.sacp-shop){background:transparent;padding:0;box-shadow:none}
#player .player-bar{grid-template-columns:auto 1fr auto;gap:10px;min-height:65px;padding:10px 18px}
#player .player-back,#player .player-actions button,#player .player-actions a{font-size:14px;border-radius:15px;min-height:44px;padding:10px 13px}
#player .player-middle{font-size:16px}
#player .player-actions{gap:7px}
#player .player-direct{display:inline-flex;align-items:center;justify-content:center;background:#e9f6f1;color:#126a55;font-weight:900}
#player .player-actions .complete-btn{display:none} /* Quizzes belong in parent dashboard, not children's reading area */
#player .player-loading .sa-loading-hint{font-size:13px;color:#507787;font-weight:500;margin:0;text-align:center}
body.sa-book-open #wpadminbar{display:none!important}
body.sa-book-open.admin-bar #player{top:0;height:100dvh}
body.sa-book-open .site-header{visibility:hidden}
#player{height:100dvh}
@media(max-width:782px){body.sa-book-open.admin-bar #player{top:0;height:100dvh}}
@media(max-width:700px){#player .player-bar{grid-template-columns:1fr auto;display:grid!important;min-height:65px;padding:8px}#player .player-actions{flex-wrap:nowrap}#player .player-back,#player .player-actions button,#player .player-actions a{font-size:12px;padding:8px}#player .player-middle{display:none}#player .player-direct .desktop-label{display:none}.academy-grid .subject-body h3{font-size:22px}.hero-art{min-height:320px}}

.sa-store-unavailable{background:linear-gradient(145deg,#f0fbf6,#fff9ea);border:2px solid #dcf1e7;border-radius:25px;text-align:center;padding:48px 24px;max-width:900px;margin:20px auto}
.sa-store-unavailable .sa-store-icon{font-size:70px}
.sa-store-unavailable h2{font-size:clamp(28px,3vw,42px);color:#193b55;margin:14px 0}
.sa-store-unavailable p{font-size:17px;line-height:1.8;color:#537686}
.sa-store-unavailable .sa-shop-admin-note{padding:15px;border:1px solid #f5d1a5;background:#fff9e9;border-radius:14px;margin:16px 0;color:#63431b;text-align:left}
/* One compact Academy exit row + native book controls, not repeated lesson menus. */
#player .player-bar{grid-template-columns:1fr auto!important;min-height:54px!important;padding:6px 12px!important}
#player .player-middle,#player #openSeparate{display:none!important}
#player .player-actions{grid-column:2;grid-row:1}
#player .player-back{grid-column:1;grid-row:1}

/* SERDEC Academy 3.3 – professional, accessible parent authentication */
.auth-inline-actions{display:flex;justify-content:flex-end;margin:3px 0 0}
.auth-inline-link,.auth-back{border:0;background:none;color:#128766;text-decoration:underline;font-weight:850;padding:6px 2px;cursor:pointer;font-size:13px}
.auth-inline-link:hover,.auth-back:hover{color:#0f644e}
.auth-back{align-self:center;text-decoration:none;margin-top:9px}
.auth-reset-icon{width:64px;height:64px;background:#e8f7ef;border-radius:20px;display:grid;place-items:center;font-size:32px;margin:3px auto}
.auth-reset-intro{color:#657c89;line-height:1.7;font-size:14px;text-align:center;margin:8px 0 15px}
.auth-form .field-wrapper .password-toggle{width:36px;height:36px;right:9px;top:50%;display:grid;place-items:center;border-radius:10px;background:#f0f7f5;color:#31556b;transform:translateY(-50%);font-size:15px;padding:4px}
.auth-form .field-wrapper input:has(+ .password-toggle){padding-right:55px}
.auth-submit:disabled{opacity:.65;cursor:wait;transform:none}
#authMessage{line-height:1.6;word-break:normal;overflow-wrap:break-word}
#authMessage.success{background:#e7faf0;border-color:#b0e9ce;color:#116b4e}
#authOverlay .modal{scrollbar-width:thin;scrollbar-color:#cfe5de transparent}
@media(max-width:640px){#authOverlay{padding:12px}#authOverlay .modal{padding:25px 18px;max-height:calc(100dvh - 25px)}.auth-reset-intro{font-size:13px}}

/* Kids storefront paywall: full-size buy action, never an ambiguous arrow. */
.sa-pay-book-btn{display:inline-flex;align-items:center;justify-content:center;min-height:46px;padding:10px 17px;border:0;border-radius:14px;background:#169a79;color:#fff!important;font-size:14px;font-weight:900;text-decoration:none!important;white-space:nowrap;box-shadow:0 4px 0 #0c7358;transition:transform .2s,background .2s}
.sa-pay-book-btn:hover,.sa-pay-book-btn:focus-visible{background:#107e62;transform:translateY(-2px)}
.sa-pay-book-btn.pending{background:#eaf5f1;color:#176b5a!important;box-shadow:none;border:1px solid #cde8df}
.academy-grid .subject-footer{flex-wrap:wrap}
.academy-grid .subject-check{line-height:1.45}
@media(max-width:420px){.sa-pay-book-btn{width:100%}}

/* Version 3.4.1 - make every locked book's next step clearly clickable */
.academy-grid .subject-card-clickable {cursor:pointer;}
.academy-grid .subject-card-clickable:hover .sa-pay-book-btn,
.academy-grid .subject-card-clickable:focus-visible .sa-pay-book-btn {background:#107e62;box-shadow:0 4px 0 #09573f;color:#fff!important}
.academy-grid .sa-book-setup-link{background:#e8f4ee;color:#126d58!important;border:1px solid #bfe8d5;box-shadow:none}
.academy-grid .subject-card-clickable:hover .sa-book-setup-link,
.academy-grid .subject-card-clickable:focus-visible .sa-book-setup-link {background:#c7f2df;color:#0d5a44!important;box-shadow:none}
.academy-grid .subject-card-clickable:focus-visible {outline:4px solid #139c80;outline-offset:4px;}

/* SERDEC 3.4.3: two distinct purchase choices on locked books. */
.sa-book-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;max-width:100%}
.sa-book-actions .sa-cart-book-btn{display:inline-flex;justify-content:center;align-items:center;min-height:44px;padding:8px 12px;border:1px solid #abd9ca;border-radius:13px;background:#effaf4;color:#146b55!important;font-size:13px;font-weight:900;text-decoration:none!important;white-space:nowrap}
.sa-book-actions .sa-cart-book-btn:hover{background:#d7f2e5}
.sa-book-actions .sa-pay-book-btn{min-height:44px;padding:8px 12px;font-size:13px}
@media(max-width:420px){.sa-book-actions{width:100%}.sa-book-actions>a{flex:1}}

/* 3.4.5: child-friendly fullscreen: controls remain visible inside the parent fullscreen element */
#player:fullscreen{position:fixed!important;inset:0!important;width:100vw!important;height:100dvh!important;max-width:none!important;background:#edfaff!important;z-index:2147483647!important}
#player:fullscreen .player-bar{min-height:57px;flex-shrink:0}
#player .player-loading.sa-soft-loading{opacity:0;pointer-events:none;transition:opacity .25s}
.brand-mark--image img,.modal-icon--logo img{object-fit:contain!important;display:block!important}
@media(max-width:680px){#player:fullscreen .player-bar{min-height:54px}}




/* SERDEC Academy 3.8.0: Somali book card displays the COMPLETE picture, no cropping. */
.subjects-section .academy-grid .subject-card:first-child .subject-image {
    background: #fbf8ef !important;
    background-image: none !important;
}
.subjects-section .academy-grid .subject-card:first-child .subject-image img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    max-width: 100% !important;
    transform: none !important;
}
.subjects-section .academy-grid .subject-card:first-child:hover .subject-image img {
    transform: none !important;
}

/* SERDEC Academy 3.9.0: Somali book card - no oversized emoji, no crop. */
.subjects-section .academy-grid .subject-card:first-child .subject-emoji { display: none !important; }
.subjects-section .academy-grid .subject-card:first-child .subject-image {
    position: relative !important;
    background: #faf7ee !important;
    padding: 0 !important;
    overflow: hidden !important;
}
.subjects-section .academy-grid .subject-card:first-child .subject-image img {
    display: block !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    transform: none !important;
    filter: none !important;
}
.subjects-section .academy-grid .subject-card:first-child:hover .subject-image img {
    transform: none !important;
}

/* SERDEC Universal Book Reader 4.0 – full-window on every device and clear back/exit */
#player{position:fixed!important;inset:0!important;width:100vw!important;height:100dvh!important;z-index:2147483000!important;display:flex!important;flex-direction:column!important;background:#fff!important}
#player.hidden{display:none!important}
#player .player-bar{position:relative;display:flex!important;align-items:center!important;justify-content:space-between!important;flex-wrap:nowrap!important;gap:9px!important;min-height:57px!important;padding:7px max(10px,env(safe-area-inset-right)) 7px max(10px,env(safe-area-inset-left))!important;flex:0 0 auto!important;z-index:15!important}
#player .sa-reader-left-actions{display:flex;align-items:center;gap:8px;flex:0 1 auto;min-width:0}
#player .sa-reader-left-actions .player-back{position:static!important;grid-column:auto!important;grid-row:auto!important;display:inline-flex;align-items:center;justify-content:center;min-height:42px!important;white-space:nowrap;padding:9px 13px!important;font-size:14px!important}
#player #playerLessonBack{background:#dff6ee;color:#0a6e55}
#player #playerBack{background:#fff0ea;color:#943d2d}
#player .player-actions{display:flex!important;gap:6px;grid-column:auto!important;grid-row:auto!important;flex:0 0 auto}
#player #playerFullscreen{display:inline-flex!important;align-items:center;justify-content:center;min-width:44px!important;min-height:42px!important}
#player #bookFrame{flex:1 1 auto!important;width:100%!important;min-height:0!important;border:0!important;display:block!important}
#player .player-loading{top:57px!important}
#player:fullscreen{width:100vw!important;height:100dvh!important;overflow:hidden}
body.sa-book-open{overflow:hidden!important}
@media(max-width:620px){
 #player .player-bar{padding:6px 5px!important;gap:4px!important;min-height:54px!important}
 #player .sa-reader-left-actions{gap:4px}
 #player .sa-reader-left-actions .player-back{padding:7px 8px!important;font-size:12px!important;min-height:40px!important}
 #player #playerBack{font-size:12px!important}
 #player .player-actions button{padding:7px!important;min-width:38px!important;min-height:40px!important}
 #player .player-loading{top:54px!important}
}

/* SERDEC 4.0.1: only the toolbar fullscreen toggle is shown on every book. */
#player:fullscreen .player-bar{padding-top:7px!important;min-height:57px!important}
@media(max-width:680px){#player:fullscreen .player-bar{padding-top:6px!important;min-height:54px!important}}

/* SERDEC Academy – four user-provided book covers (2026-11-06).
   Preserve the existing card dimensions and show the ENTIRE image, with no cropping.
   Only math, arabic, environment and islam are affected. */
.subjects-section .academy-grid .subject-card.serdec-new-cover .subject-image {
    overflow: hidden;
    padding: 0;
    background: var(--soft);
}
.subjects-section .academy-grid .subject-card.serdec-new-cover .subject-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    object-position: center center !important;
    transform: none !important;
    filter: none !important;
    padding: 0 !important;
}
.subjects-section .academy-grid .subject-card.serdec-new-cover:hover .subject-image img {
    transform: none !important;
}


/* SERDEC 4.2.2 - Fill the exact book-card image box for the 4 new covers.
   Set cover only on new cards; preserve Somali card and all page/reader styling.
   Source images have varying aspect ratios; a modest outer-edge crop is expected.
*/
.subjects-section .academy-grid .subject-card.serdec-new-cover .subject-image {
    padding: 0 !important;
    overflow: hidden !important;
}
.subjects-section .academy-grid .subject-card.serdec-new-cover .subject-image img {
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center 20% !important;
    border-radius: 0 !important;
    transform: none !important;
}
.subjects-section .academy-grid .subject-card.serdec-new-cover:hover .subject-image img {
    transform: none !important;
}

/* SERDEC 4.2.3 - Arabic book card shows Arabic letters, not English ABC.
   This changes only the small top-right badge; cover imagery and other cards stay as-is. */
.academy-grid .subject-card .subject-emoji.serdec-arabic-letters-badge {
  font-family: "Noto Naskh Arabic", "Amiri", Tahoma, Arial, sans-serif;
  font-size: 17px; font-weight: 800; line-height: 1;
  letter-spacing: 0; white-space: nowrap; direction: rtl;
  unicode-bidi: isolate; padding-inline: 3px; box-sizing: border-box;
}


/* SERDEC 4.2.4 — Responsive embedded-book reader on tablets and phones.
   This applies only to the book overlay; desktop/cover styles stay unchanged. */
@media(max-width:1024px), (pointer:coarse){
  html:has(body.sa-book-open){overflow:hidden!important}
  body.sa-book-open{overflow:hidden!important;overscroll-behavior:none!important}
  body.sa-book-open #player,
  body.sa-book-open.admin-bar #player{
    position:fixed!important;
    top:env(safe-area-inset-top, 0px)!important;
    right:env(safe-area-inset-right, 0px)!important;
    bottom:env(safe-area-inset-bottom, 0px)!important;
    left:env(safe-area-inset-left, 0px)!important;
    width:auto!important;
    height:auto!important;
    max-width:100%!important;
    max-height:100dvh!important;
    min-height:0!important;
    min-width:0!important;
    overflow:hidden!important;
    border-radius:0!important;
    display:flex!important;
    flex-direction:column!important;
    box-sizing:border-box!important;
  }
  #player .player-bar{
    display:flex!important;
    flex:0 0 auto!important;
    align-items:center!important;
    justify-content:space-between!important;
    flex-wrap:nowrap!important;
    width:100%!important;
    min-width:0!important;
    min-height:48px!important;
    padding:5px 9px!important;
    gap:4px!important;
    box-sizing:border-box!important;
  }
  #player .sa-reader-left-actions{display:flex!important;flex:1 1 auto!important;min-width:0!important;gap:5px!important}
  #player .sa-reader-left-actions .player-back{
    flex:0 1 auto!important;min-width:0!important;
    min-height:38px!important;padding:7px 9px!important;
    font-size:clamp(11px,1.8vw,13px)!important;
    overflow:hidden!important;text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  #player .player-actions{display:flex!important;flex:0 0 auto!important;min-width:0!important;gap:3px!important}
  #player #playerFullscreen{display:none!important}
  #player .player-direct{display:inline-flex!important;min-height:38px!important;min-width:38px!important;padding:7px 8px!important;font-size:14px!important}
  #player #bookFrame{
    box-sizing:border-box!important;
    display:block!important;
    flex:1 1 0%!important;
    width:100%!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-width:100%!important;
    max-height:100%!important;
    border:0!important;
    overflow:auto!important;
    background:#fff!important;
  }
  #player .player-loading{top:48px!important}
}
@media(max-width:390px){
  #player .player-bar{padding:4px 5px!important}
  #player .sa-reader-left-actions{gap:3px!important}
  #player .sa-reader-left-actions .player-back{padding:6px 7px!important;font-size:11px!important;min-height:36px!important}
  #player .player-direct{min-width:34px!important;min-height:36px!important;padding:6px!important}
}
@media(max-width:1024px) and (orientation:landscape){
  #player .player-bar{min-height:42px!important;padding-top:3px!important;padding-bottom:3px!important}
  #player .sa-reader-left-actions .player-back{min-height:34px!important}
  #player .player-direct{min-height:34px!important}
  #player .player-loading{top:42px!important}
}


/* SERDEC 4.2.6 — Maktabadda and all-book mobile/tablet usability.
   Site-level styles only. Embedded same-origin book contents are handled
   by a separate, scoped JS-injected stylesheet. Desktop theme is unchanged. */
@media (max-width:1080px) {
  #maktabadda .library-feature {
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:clamp(16px,3vw,28px)!important;
    width:100%!important;
    max-width:100%!important;
    padding:0!important;
    min-width:0!important;
    align-items:stretch!important;
  }
  #maktabadda .library-art {
    box-sizing:border-box!important;
    width:100%!important;
    max-width:650px!important;
    min-width:0!important;
    min-height:clamp(255px,38vw,385px)!important;
    height:auto!important;
    aspect-ratio: 16 / 10;
    margin-inline:auto!important;
    overflow:visible!important;
    border-radius:clamp(18px,4vw,32px)!important;
  }
  #maktabadda .library-img-wrap {
    box-sizing:border-box!important;
    width:min(58%,270px)!important;
    max-width:calc(100% - 30px)!important;
    height:calc(100% - 30px)!important;
    max-height:330px!important;
    margin:auto!important;
    transform:none!important;
    padding:0!important;
    border:clamp(4px,.9vw,8px) solid white!important;
    border-radius:18px!important;
    overflow:hidden!important;
  }
  #maktabadda .library-img-wrap:hover{transform:none!important}
  #maktabadda .library-img-wrap img{
    display:block!important;
    width:100%!important;height:100%!important;
    object-fit:contain!important;object-position:center!important;
    transform:none!important;
  }
  #maktabadda .library-copy {
    box-sizing:border-box!important;
    min-width:0!important;
    width:100%!important;
    max-width:680px!important;
    margin-inline:auto!important;
    padding:0!important;
  }
  #maktabadda .library-copy h2{
    font-size:clamp(27px,4vw,42px)!important;
    line-height:1.16!important;
    overflow-wrap:break-word!important;
  }
  #maktabadda .library-points {min-width:0!important;margin-bottom:22px!important}
  #maktabadda .library-copy .btn {
    max-width:100%!important;
    min-width:0!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    min-height:48px!important;
    line-height:1.35!important;
  }
}
@media (max-width:700px){
  /* Library and book cards: no clipped sides on portrait phones. */
  #maktabadda,.subjects-section{min-width:0!important;width:100%!important}
  #maktabadda .container,.subjects-section .container{min-width:0!important;max-width:100%!important}
  #maktabadda .library-art{
    aspect-ratio:5 / 4;
    min-height:220px!important;
    max-height:370px!important;
  }
  #maktabadda .library-blob {font-size:clamp(20px,6vw,34px)!important}
  #maktabadda .library-copy>p {font-size:clamp(14px,3.7vw,16px)!important;line-height:1.7!important}
  #maktabadda .library-copy h2 {font-size:clamp(25px,7vw,36px)!important}
  #maktabadda .library-copy .btn {display:flex!important;width:100%!important;min-height:48px!important}
  .academy-grid .subject-card{min-width:0!important;max-width:100%!important}
  .academy-grid .subject-body{padding:clamp(15px,4vw,24px)!important;min-width:0!important}
  .academy-grid .subject-body h3{font-size:clamp(20px,5.8vw,25px)!important;overflow-wrap:break-word!important}
  .academy-grid .subject-image{width:100%!important;min-width:0!important}
  #mobileNav.open{
    position:absolute!important;top:100%!important;left:0!important;right:0!important;
    max-height:calc(100dvh - 68px)!important;overflow-y:auto!important;
    overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch!important;
    z-index:110!important;box-sizing:border-box!important;
    padding-bottom:max(18px,env(safe-area-inset-bottom,0px))!important;
  }
  #mobileNav.open a,#mobileNav.open button {min-height:44px!important;overflow-wrap:break-word!important}
}
@media (max-width:400px){
  #maktabadda .library-art{min-height:210px!important;aspect-ratio: 5 / 4!important}
  #maktabadda .library-img-wrap {width:min(62%,220px)!important;height:calc(100% - 24px)!important}
  #maktabadda .library-copy h2{letter-spacing:-.65px!important}
  /* On 320px wide phones, keep the Academy exit available without side overflow. */
  #player .player-bar{min-width:0!important;max-width:100%!important}
  #player .sa-reader-left-actions .player-back{font-size:11px!important}
  #player .player-actions{min-width:0!important}
  #player .player-actions .complete-btn {display:none!important}
}
@media (max-width:1024px) and (orientation:landscape) and (max-height:560px){
  #maktabadda .library-art{min-height:220px!important;max-height:280px!important}
  #player .player-bar{padding-top:2px!important;padding-bottom:2px!important}
}
@media (max-width:1024px), (pointer:coarse){
  #player .player-actions .player-direct {
    display:inline-flex!important;
    box-sizing:border-box!important;
    flex:0 0 42px!important;
    width:42px!important;min-width:42px!important;
    height:42px!important;min-height:42px!important;
    justify-content:center!important;align-items:center!important;
  }
}


/* SERDEC 4.2.7 — ONLY Maktabadda: keep 'Xiga' at the right edge on mobile/tablet.
   Other books, desktop layout, and library story files are unchanged. */
#player .sa-library-bottom-nav { display:none!important; }
@media (max-width:1024px), (pointer:coarse) {
  #player.sa-library-reader-open .sa-library-bottom-nav {
    box-sizing:border-box!important;
    display:flex!important;
    flex:0 0 auto!important;
    flex-direction:row!important;
    justify-content:flex-end!important;
    align-items:center!important;
    min-width:0!important;
    width:100%!important;
    min-height:54px!important;
    padding:5px max(12px,env(safe-area-inset-right,0px))
      max(7px,env(safe-area-inset-bottom,0px)) 12px!important;
    background:#f0fafb!important;
    border-top:1px solid #dbecef!important;
    position:relative!important;
    z-index:20!important;
  }
  #player.sa-library-reader-open #saLibraryNext {
    box-sizing:border-box!important;
    display:inline-flex!important;
    flex:0 0 auto!important;
    justify-content:center!important;
    align-items:center!important;
    min-width:92px!important;
    height:43px!important;
    padding:7px 15px!important;
    border:0!important;
    border-radius:14px!important;
    background:#163f66!important;
    color:white!important;
    font-family:inherit!important;
    font-weight:800!important;
    font-size:15px!important;
    text-align:center!important;
    white-space:nowrap!important;
    cursor:pointer!important;
    touch-action:manipulation!important;
  }
  #player.sa-library-reader-open #saLibraryNext:focus-visible {
    outline:3px solid #ffbf36!important;
    outline-offset:2px!important;
  }
}

/* 4.2.8: the repaired Maktabadda reader has its own visible navigation.
   Avoid showing an extra theme-level Xiga button when that reader is active. */
#player.sa-library-reader-open.sa-library-native-nav-ready .sa-library-bottom-nav{display:none!important}

/* SERDEC ACADEMY v4.5.0: hide all direct-open / redundant bottom reader widgets. */
#player #playerDirect,#player .player-direct,#player .sa-loading-hint{display:none!important}
/* Never hide the Academy TOP fullscreen button. */
#player #playerFullscreen{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:42px!important;min-height:40px!important}
/* Maktabadda has native Hore/Xiga; no duplicate footer arrow. */
#player.sa-library-reader-open .sa-library-bottom-nav{display:none!important}
@media(max-width:680px){
 #player .player-actions{gap:3px!important;min-width:0!important}
 #player #playerFullscreen{flex:0 0 42px!important;width:42px!important;min-width:42px!important;padding:7px!important}
 #player #playerFullscreen .desktop-label{display:none!important}
}

/* 4.5.1: Keep the complete new coloring-book cover inside its card. */
.subjects-section .academy-grid .subject-card.serdec-farshaxanka-card .subject-image {
  background:#fff4e5 !important;
}
.subjects-section .academy-grid .subject-card.serdec-farshaxanka-card .subject-image img {
  object-fit:contain !important;
  object-position:center center !important;
  max-width:100% !important;
  max-height:100% !important;
  min-width:0 !important;
  min-height:0 !important;
}

/* v4.5.8: keep the top-level Ku noqo above iframe/loading overlays. */
#player .player-bar{z-index:50!important;pointer-events:auto!important}
#player #playerLessonBack{position:relative!important;z-index:60!important;pointer-events:auto!important;touch-action:manipulation!important;cursor:pointer!important}


/* SERDEC 4.6.0 — native fullscreen when supported; safe fallback otherwise. */
#player:fullscreen,
#player:-webkit-full-screen{
  position:fixed!important;inset:0!important;
  width:100vw!important;height:100dvh!important;
  box-sizing:border-box!important;display:flex!important;
  flex-direction:column!important;overflow:hidden!important;
  background:#fff!important;
}
#player:fullscreen #bookFrame,
#player:-webkit-full-screen #bookFrame{
  display:block!important;flex:1 1 0%!important;
  min-height:0!important;height:100%!important;width:100%!important;
}
#player:fullscreen .player-bar,
#player:-webkit-full-screen .player-bar{
  flex:0 0 auto!important;pointer-events:auto!important;
}
#player #playerLessonBack:focus-visible,
#player #playerBack:focus-visible,
#player #playerFullscreen:focus-visible{
  outline:3px solid #e4a519!important;outline-offset:2px!important;
}

/* v4.6.3: Book home (NOT menu) fallback for legacy Soomaaliga,
   Deegaanka and Tarbiyada readers. Does not modify fullscreen CSS. */
#player .sa-book-home-cover[hidden]{display:none!important}
#player .sa-book-home-cover{
  position:absolute;inset:57px 0 0;z-index:20;box-sizing:border-box;
  background:#f3fbf7;display:flex;align-items:center;justify-content:center;
  overflow:auto;padding:16px;
}
#player .sa-book-home-panel{
  width:min(100%,520px);max-height:100%;box-sizing:border-box;
  background:#fff;border:2px solid #d8efe5;border-radius:23px;
  padding:clamp(14px,3vh,25px);text-align:center;display:flex;
  flex-direction:column;align-items:center;gap:10px;overflow:auto;
  box-shadow:0 10px 34px rgba(18,73,51,.12)
}
#player .sa-book-home-image{
  display:block;width:100%;height:min(49vh,310px);max-height:310px;
  object-fit:contain;object-position:center;border-radius:13px
}
#player .sa-book-home-image[hidden]{display:none!important}
#player .sa-book-home-title{font-size:clamp(20px,3.5vw,27px);line-height:1.2;margin:0;color:#135440}
#player .sa-book-home-panel p{margin:0;color:#4d665d;font-size:15px}
#player .sa-book-home-bilow{border:0;border-radius:16px;background:#159875;color:#fff;
  font-size:20px;font-weight:800;min-height:54px;min-width:190px;padding:10px 26px;
  cursor:pointer;touch-action:manipulation}
#player .sa-book-home-bilow:focus-visible{outline:3px solid #db9a25;outline-offset:3px}
@media(max-width:680px){
  #player .sa-book-home-cover{inset:54px 0 0;padding:10px}
  #player .sa-book-home-panel{gap:8px;padding:12px}
  #player .sa-book-home-image{height:min(42vh,240px)}
  #player .sa-book-home-bilow{min-height:48px}
}

/* v4.6.5: Same navigation stages for all seven books.
   This is an in-reader menu fallback only; fullscreen CSS unchanged. */
#player .sa-book-menu-fallback[hidden]{display:none!important}
#player .sa-book-menu-fallback .sa-book-home-panel{gap:16px;justify-content:center}
#player .sa-book-menu-fallback .sa-book-menu-title{font-weight:800;color:#136b51}

/* SERDEC customer-number login 4.7.4 (does not affect readers or fullscreen) */
.sa-alternate-login{display:flex;flex-direction:column;align-items:flex-start;gap:2px;margin:4px 0 12px}
.sa-alternate-login .auth-inline-link{min-height:35px;text-align:left}
.sa-alternate-login p{font-size:12px;line-height:1.5;color:#526b65;margin:0 0 2px}
.sa-account-details{display:flex;flex-wrap:wrap;gap:6px 14px;align-items:center;background:#f2fbf7;border:1px solid #cce8dc;border-radius:14px;padding:11px 15px;margin:8px 0 16px;font-size:14px}
.sa-account-details strong{color:#125c48}.sa-account-details span{color:#395e50;font-size:12px}.sa-account-details code{font-weight:bold;letter-spacing:0.5px;white-space:nowrap}

.auth-tip-box{background:linear-gradient(180deg,#f3fbf7,#ffffff);border:1px solid #d7eee5;border-radius:16px;padding:12px 14px;margin:0 0 14px;color:#36596a;line-height:1.65;font-size:14px}
.auth-tip-box--register{background:linear-gradient(180deg,#fffaf0,#ffffff);border-color:#f1dfb2}
.auth-form .field-row{gap:14px;margin-bottom:4px}
.auth-form .field-wrapper{position:relative}
.auth-form .field-wrapper .field-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);font-size:16px;color:#5b7482;pointer-events:none}
.auth-form .field-wrapper input{padding-left:40px}
.auth-form label{font-weight:800;color:#25485b;margin-bottom:6px;display:block}
.auth-note{background:#f7fbfd;border:1px dashed #cde1e8;border-radius:14px;padding:12px 14px;line-height:1.7;color:#58707d;font-size:13px}
#authOverlay .modal-header p{max-width:520px;margin:6px auto 0}
