/* Shared book layout; application behavior stays in the shared app. */
@font-face{font-family:BookQuran;src:url('../data/AmiriQuran-Regular.ttf') format('truetype');font-weight:400;font-style:normal;font-display:swap}
/* One bundled Unicode font for the Quran and recognized Arabic alike. */
.book-view .word,.book-view .bismillah-line .word,.book-view [lang=ar],.book-view .ayah-number{font-family:BookQuran,serif}
.book-view #word-info.is-review .word-info-arabic{font-family:BookQuran,serif;font-size:20px;font-weight:400;line-height:1.8}
/* The reading controls and account icon share one palette for each state. */
body.book-view{background:#e9e6dd;min-height:100vh;--control-off-light:#adb9c1;--control-off-deep:#5b6c7b;--control-off-edge:#344653;--control-off-ivory:#e2ebef;--control-off-board:#8297a4;--control-on-light:#79ceb5;--control-on-deep:#256d58;--control-on-edge:#174b3d;--control-on-ivory:#d2f3e6;--control-on-board:#6da68a}
body.book-view.dark{background:#0e1712;--control-off-light:#91a3b0;--control-off-deep:#435969;--control-off-edge:#263b49;--control-off-ivory:#d8e5ec;--control-off-board:#6d8799;--control-on-light:#83d8bf;--control-on-deep:#245e50;--control-on-edge:#113d32;--control-on-ivory:#bce5d6;--control-on-board:#5e9d80}
.book-view .header{height:0;padding:0;margin:0}
.book-view .header .bismillah{display:none}
.book-view .header .app-version{position:fixed;top:10px;right:10px;z-index:12;background:var(--paper)}
/* Each layout identifies its loaded version at the far right. */
.book-view main{max-width:1180px;padding:38px 24px 32px;margin:0 auto}
.book-view .reader{margin:0 auto;padding:0 28px;border-radius:3px;box-shadow:0 20px 65px #0002,inset 0 0 0 5px var(--paper),inset 0 0 0 6px var(--border);background:linear-gradient(90deg,#00000004,transparent 5%,transparent 95%,#00000005),var(--paper)}
.book-view .surah-heading{padding:12px 0}
.book-view #surah-title{font-family:BookQuran,serif;font-size:16px;line-height:1.6;direction:rtl;text-align:right;justify-self:end;align-self:center;min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
.book-view .reader-footer{font-size:10px;padding:13px 0}
.book-view .reader-footer .legend{display:none}
/* The desktop rail uses the gutter; the page never shifts for controls. */
.book-view .practice{position:fixed;top:80px;bottom:auto;left:16px;z-index:10;width:54px;margin:0;padding:6px;border-radius:28px;background:var(--card);box-shadow:0 8px 35px #0002}
.book-view .recorder{padding:0;border:0}
.book-view .recorder-main{gap:8px;flex-wrap:nowrap;flex-direction:column}
.book-view .recorder-main>.book-control{display:flex;align-items:center;justify-content:center;flex:0 0 40px;width:40px;height:40px;min-width:40px;min-height:40px;border:0;border-radius:50%;padding:8px;transition:background 220ms ease,color 220ms ease,box-shadow 220ms ease,transform 220ms ease}
.book-view .recorder-main>.book-control:hover:not(:disabled){transform:translateY(-1px)}
.book-view .recorder-main>.book-control:active:not(:disabled){transform:scale(.94)}
.book-view .book-control svg,.book-view #teacher-icon-on,.book-view #teacher-icon-off{display:flex;align-items:center;justify-content:center}
/* Off/closed is slate; enabled/open, including live capture, is emerald. */
.book-view :is(#record,#teacher-enabled,#visibility,#book-search,#book-menu).book-control{position:relative;--control-light:var(--control-off-light);--control-deep:var(--control-off-deep);--control-edge:var(--control-off-edge);--control-ivory:var(--control-off-ivory);--control-board:var(--control-off-board);padding:0;border-radius:14px;background:transparent}
.book-view .book-mic-symbol,.book-view .teacher-symbol,.book-view .book-orb-symbol{display:block;width:40px;height:40px;flex:none;overflow:visible;filter:drop-shadow(0 3px 2px #071e1b30) drop-shadow(0 1px 0 #ffffff48);transition:filter 220ms ease}
/* Visibility's pressed state means hidden text, so the printed page is green. */
.book-view :is(#record.recording,#teacher-enabled[aria-pressed=true],#visibility[aria-pressed=false],#book-search[aria-expanded=true],#book-menu[aria-expanded=true]){--control-light:var(--control-on-light);--control-deep:var(--control-on-deep);--control-edge:var(--control-on-edge);--control-ivory:var(--control-on-ivory);--control-board:var(--control-on-board)}
.book-view #record.recording{box-shadow:0 0 0 var(--voice-glow,6px) color-mix(in srgb,var(--control-on-light) 12%,transparent)}
.book-view #record.recording::before,.book-view #record.recording::after{border-radius:16px;border-color:var(--control-on-light)}
.book-view #teacher-enabled{--teacher-figure:var(--control-on-light)}
.book-view #teacher-icon-on,.book-view #teacher-icon-off{flex:0 0 40px}
/* Only the surrounding rings animate, using the microphone's ripple timing.
   The Teacher artwork remains still; voice search does not activate the rings. */
.book-view.reciting #teacher-enabled[aria-pressed=true]::before,.book-view.reciting #teacher-enabled[aria-pressed=true]::after{content:'';position:absolute;inset:-4px;border:1.5px solid var(--teacher-figure);border-radius:50%;pointer-events:none;animation:mic-ripple 2.2s ease-out infinite}
.book-view.reciting #teacher-enabled[aria-pressed=true]::after{animation-delay:1.1s}
@media(prefers-reduced-motion:reduce){
  .book-view.reciting #teacher-enabled[aria-pressed=true]::before,.book-view.reciting #teacher-enabled[aria-pressed=true]::after{animation:none;opacity:.3}
  .book-view .book-mic-symbol,.book-view .teacher-symbol,.book-view .book-orb-symbol{transition:none}
}
.book-view #teacher-tooltip{position:absolute;display:block;z-index:20;left:calc(100% + 14px);top:50%;width:270px;max-width:calc(100vw - 24px);padding:13px 15px;border:1px solid var(--border);border-radius:14px;background:color-mix(in srgb,var(--card) 94%,transparent);color:var(--ink);box-shadow:0 10px 32px #0002;backdrop-filter:blur(8px);font-size:12px;font-weight:400;line-height:1.65;text-align:left;white-space:normal;pointer-events:none;opacity:0;visibility:hidden;transform:translateY(-50%) scale(.9);transform-origin:left center;transition:opacity 240ms ease,transform 240ms ease,visibility 240ms}
.book-view #teacher-enabled:hover #teacher-tooltip,.book-view #teacher-enabled:focus-visible #teacher-tooltip{opacity:1;visibility:visible;transform:translateY(-50%) scale(1)}
.book-view #status,.book-view #model-picker{width:min(280px,calc(100vw - 100px));white-space:normal;font-size:12px;padding:10px;background:var(--card);border:1px solid var(--border);border-radius:10px}
.book-view #download{width:40px}
.book-view #model-picker input{max-width:100%}
.book-view #mic-notice{bottom:calc(110px + env(safe-area-inset-bottom))}
#book-settings{position:fixed;inset:0 auto 0 0;margin:0;width:min(360px,calc(100vw - 24px));height:100dvh;max-height:100dvh;box-sizing:border-box;overflow:auto;padding:24px;border:0;border-right:1px solid var(--border);border-radius:0;background:var(--card);color:var(--ink);box-shadow:8px 0 40px #0002;z-index:15}
#book-settings::backdrop{background:#07181050}
#book-settings .book-session .recitation-counts{display:flex;justify-content:space-between;gap:10px;font-size:11px}
#book-settings .book-session strong{display:block;font-size:20px}
#book-settings .session-inline{display:block;width:100%;max-width:none;margin-top:14px}
.book-settings-heading{display:flex;justify-content:flex-end;align-items:center;margin-bottom:4px}
#book-close{font-size:26px}
#book-settings section:first-of-type{border-top:0;padding-top:0}
#book-settings section{padding:16px 0;border-top:1px solid var(--border)}
#book-settings h3{font-size:12px;font-weight:600;margin:0 0 12px}
#book-settings .search-surah-row{display:grid;grid-template-columns:42px minmax(0,1fr);gap:8px}
#book-settings .unified-search{grid-column:1 / -1;grid-row:2}
#book-settings #search-hint{grid-column:1 / -1;grid-row:3;margin:0;line-height:1.6}
#book-settings #search-lock-info{inset:0;height:100%}
#book-settings #search-lock-tip{top:100%}
#book-settings .practice-actions{justify-content:flex-start;flex-wrap:wrap;margin:0;gap:8px}
#book-settings .practice-actions #theme{flex-shrink:0;width:34px;min-width:34px;padding:6px}
#book-settings .font-controls{margin-left:auto}
#book-settings .history{margin:12px 0;padding:12px}
#book-settings footer{margin-top:16px}
.book-view #word-info .word-info-madd{border-top:1px solid var(--border);margin-top:10px;padding-top:10px}
.book-view #book-settings .tajweed-preview-settings{display:grid;gap:8px}
.book-view #book-settings .tajweed-preview-settings label{margin:0;font-size:12px;font-weight:600}
.book-view #book-settings .tajweed-preview-settings .hint{margin:0;line-height:1.6}
.book-view #word-info .word-info-timing-preview>.word-info-note{margin:4px 0 8px}
/* Feedback floats over the existing margin; it never resizes the Mushaf. */
.book-view #teacher-feedback{position:fixed;z-index:14;left:50%;top:12px;translate:-50% 0;width:min(280px,calc(100vw - 28px));max-width:calc(100vw - 28px);box-sizing:border-box;padding:12px 15px 14px;border:1px solid var(--border);border-radius:18px;background:color-mix(in srgb,var(--card) 94%,transparent);color:var(--ink);box-shadow:0 12px 38px #0002;backdrop-filter:blur(12px);opacity:1;scale:1;transform-origin:center;transition:scale 420ms cubic-bezier(.2,.7,.2,1),opacity 420ms ease,display 420ms allow-discrete}
.book-view #teacher-feedback[data-placement=gutter]{top:50dvh;translate:0 -50%}
.book-view #teacher-feedback[hidden]{display:none;opacity:0;scale:.85;pointer-events:none}
.book-view #teacher-feedback:not(.is-visible){opacity:0;scale:.85;pointer-events:none}
.book-view #teacher-feedback{margin:0;right:auto;bottom:auto}
.book-view #teacher-feedback-word:empty{display:none}
.book-view #teacher-feedback[data-state=countdown]{padding-bottom:12px}
.book-view .teacher-feedback-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
.book-view #teacher-feedback-label{font-size:11px;font-weight:600;color:var(--muted)}
.book-view #teacher-dismiss{display:flex;align-items:center;justify-content:center;width:26px;height:26px;min-width:26px;min-height:26px;padding:0;border:0;font-size:23px;line-height:1;background:transparent;color:var(--muted)}
.book-view #teacher-feedback-word{font-family:BookQuran,serif;font-size:28px;font-weight:400;line-height:1.8;margin:3px 0 6px;text-align:center;overflow-wrap:anywhere}
.book-view #teacher-feedback-detail{font-size:12px;line-height:1.5;margin:0}
.book-view #teacher-replay{display:block;margin:10px auto 0;padding:6px 12px;font-size:11px}
@starting-style{.book-view #teacher-feedback:not([hidden]){opacity:0;scale:.85}}
@media(prefers-reduced-motion:reduce){.book-view #teacher-feedback{transition:none}}
/* Opening and closing motion. Discrete display/overlay
   transitions keep the closing surface visible until its shrink finishes. */
@keyframes book-popup-in{from{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}
.book-view :is(#book-settings,#voice-dialog,#word-info,#mic-notice,#search-lock-tip,#model-picker){
  opacity:1;scale:1;transform-origin:center;
  transition:scale 320ms cubic-bezier(.2,.7,.2,1),opacity 320ms ease,display 320ms allow-discrete,overlay 320ms allow-discrete;
}
.book-view #book-settings{transform-origin:left center}
.book-view :is(#voice-dialog:not([open]),#word-info[hidden],#mic-notice[hidden],#search-lock-tip[hidden],#model-picker[hidden]){opacity:0;scale:0;pointer-events:none}
.book-view #book-settings:not([open]){opacity:0;scale:0 1;pointer-events:none}
.book-view :is(#book-settings,#voice-dialog)::backdrop{opacity:0;transition:opacity 320ms ease,display 320ms allow-discrete,overlay 320ms allow-discrete}
.book-view :is(#book-settings,#voice-dialog)[open]::backdrop{opacity:1}
@starting-style{
  .book-view #book-settings[open]{opacity:0;scale:0 1}
  .book-view #voice-dialog[open],.book-view #word-info:not([hidden]),.book-view #mic-notice:not([hidden]),.book-view #search-lock-tip:not([hidden]),.book-view #model-picker:not([hidden]){opacity:0;scale:0}
  .book-view :is(#book-settings,#voice-dialog)[open]::backdrop{opacity:0}
}
.book-view #word-info details[open] .word-info-reference{transform-origin:top left;animation:book-popup-in 320ms cubic-bezier(.2,.7,.2,1)}
@media(prefers-reduced-motion:reduce){
  .book-view :is(#book-settings,#voice-dialog,#word-info,#mic-notice,#search-lock-tip,#model-picker),.book-view :is(#book-settings,#voice-dialog)::backdrop{transition:none}
  .book-view #word-info details[open] .word-info-reference{animation:none}
}

/* Leave the top-row badge space available on the dedicated phone layout. */
html[data-layout=mobile] .book-view.mobile-reciting main{padding-bottom:calc(32px + var(--mobile-reading-tail,0px))}
/* Phone pages turn with a horizontal gesture; vertical reading and zoom stay native. */
html[data-layout=mobile]{overflow-x:clip}
html[data-layout=mobile] .reader{touch-action:pan-y pinch-zoom;overflow-anchor:none}
/* Amiri's visible Arabic sits low in its line box. The extra bottom inset
   centers the title's ink within its frame without enlarging the text. */
html[data-layout=mobile] .book-view .mushaf-surah-header{display:flex;align-items:center;justify-content:center;min-height:2.2em;padding:0 36px .4em;line-height:1.55;margin:6px 6px 4px}
html[data-layout=mobile] .book-view .mushaf-surah-header::before,
html[data-layout=mobile] .book-view .mushaf-surah-header::after{top:50%;transform:translateY(-50%);line-height:1}
html[data-layout=mobile] .book-view .bismillah-line{margin-block:0;line-height:1.95}
html[data-layout=mobile] .book-view .bismillah-line .word{line-height:inherit}
/* Use spare phone height between printed rows without stretching the font. */
html[data-layout=mobile] .reader .mushaf-line:not(:last-child){margin-block-end:var(--mobile-line-gap,0px)}
html[data-layout=mobile] .surah-heading .page-navigation :is(#next-page,#previous-page){display:none}
html[data-layout=mobile] .mobile-page-dragging{cursor:grabbing}
html[data-layout=mobile] .mobile-page-turning{pointer-events:none}

/* Shared desktop/mobile language control. Keep the centered Mushaf and
   physical microphone/Teacher control order stable when the UI becomes RTL. */
html[data-ui-language=enabled] #book-settings .language-setting{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0 16px;border-top:0}
html[data-ui-language=enabled] .language-setting label{font-size:13px;font-weight:600;letter-spacing:0;margin:0;color:var(--ink)}
html[data-ui-language=enabled] .language-setting select{width:155px;max-width:65%;font-size:13px}
html[data-ui-language=enabled] #page-label{font-family:BookQuran,serif;font-size:16px;line-height:1.5;padding-block-end:.2em}
html[data-ui-language=enabled][lang=ar] .book-view main,
html[data-ui-language=enabled][lang=ar] .book-view .recorder-main,
html[data-ui-language=enabled][lang=ar] .book-view .surah-heading{direction:ltr}
html[data-ui-language=enabled][lang=ar] :is(#book-settings,#teacher-voices,#voice-dialog,#word-info,#teacher-feedback,#mic-notice){direction:rtl;text-align:right}
html[data-ui-language=enabled][lang=ar] :is(#book-settings,#teacher-voices,#voice-dialog,#word-info,#teacher-feedback,#mic-notice) :is(label,p,h2,h3,summary){letter-spacing:0}
html[data-ui-language=enabled][lang=ar] #book-settings .book-session{direction:rtl}
html[data-ui-language=enabled][lang=ar] #book-settings :is(.practice-actions,.font-controls),
html[data-ui-language=enabled][lang=ar] :is(.word-info-pronunciation,.session-meta){direction:ltr;unicode-bidi:isolate}
html[data-ui-language=enabled][lang=ar] #book-settings .font-controls{margin-left:0;margin-right:auto}
html[data-ui-language=enabled][lang=ar] #book-settings #search-hint{text-align:right}
html[data-ui-language=enabled][lang=ar] #search{direction:rtl;text-align:right}
html[data-ui-language=enabled][lang=ar] #mic-notice-close{margin-left:0;margin-right:auto}

/* The preview panel reserves the measured toolbar area and leaves the page
   centered. JS delays hidden on close for browsers without display animation. */
html[data-teacher-voices=preview] #teacher-voices{position:fixed;z-index:16;top:16px;left:82px;width:min(320px,calc(100vw - 98px));max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);overflow:auto;box-sizing:border-box;padding:18px;border:1px solid var(--border);border-radius:20px;background:var(--card);background:color-mix(in srgb,var(--card) 96%,transparent);color:var(--ink);box-shadow:8px 12px 44px #0003;backdrop-filter:blur(12px);opacity:0;pointer-events:none;transform:translateX(-10px) scale(.88,.92);clip-path:inset(8% 100% 8% 0 round 20px);transform-origin:left center;transition:transform 480ms cubic-bezier(.22,1,.36,1),clip-path 480ms cubic-bezier(.22,1,.36,1),opacity 260ms ease;scrollbar-width:thin;scrollbar-color:var(--border) transparent}
html[data-teacher-voices=preview] #teacher-voices[data-placement=row]{transform:translateY(-10px) scale(.92,.92);clip-path:inset(0 0 100% 0 round 20px);transform-origin:center top}
html[data-teacher-voices=preview] #teacher-voices.is-open{opacity:1;pointer-events:auto;transform:translate(0) scale(1);clip-path:inset(0 round 20px)}
html[data-teacher-voices=preview] #teacher-voices>:not(.teacher-voices-heading){opacity:0;transform:translateY(8px);transition:opacity 180ms ease,transform 320ms cubic-bezier(.22,1,.36,1)}
html[data-teacher-voices=preview] #teacher-voices.is-open>:not(.teacher-voices-heading){opacity:1;transform:translateY(0);transition-duration:300ms,420ms;transition-delay:90ms}
html[data-teacher-voices=preview] .teacher-voices-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 8px}
html[data-teacher-voices=preview] .teacher-voices-heading h2{font-size:17px;font-weight:650;line-height:1.4;margin:0}
html[data-teacher-voices=preview] .teacher-voices-close{display:flex;align-items:center;justify-content:center;width:30px;height:30px;min-width:30px;min-height:30px;padding:0;font-size:26px;line-height:1;border-radius:50%;color:var(--muted)}
html[data-teacher-voices=preview] .teacher-voices-help{font-size:12px;line-height:1.65;color:var(--muted);margin:0 0 14px}
html[data-teacher-voices=preview] .teacher-voices-enable-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:11px 12px;border:1px solid var(--border);border-radius:13px;background:var(--paper);font-size:13px;font-weight:650}
html[data-teacher-voices=preview] .teacher-voices-toggle{display:flex;align-items:center;justify-content:center;gap:8px;flex:0 0 87px;min-width:87px;min-height:36px;padding:7px 8px;border:1px solid var(--border);border-radius:22px;background:var(--card);color:var(--muted);font-size:12px;font-weight:650;line-height:1;transition:background 220ms ease,color 220ms ease,border-color 220ms ease}
html[data-teacher-voices=preview] .teacher-voices-toggle[aria-checked=true]{border-color:var(--green);background:var(--soft);color:var(--green)}
html[data-teacher-voices=preview] .teacher-voices-toggle:focus-visible{outline:2px solid var(--green);outline-offset:3px}
html[data-teacher-voices=preview] .teacher-voices-switch-track{display:block;position:relative;flex:0 0 32px;width:32px;height:18px;border-radius:12px;background:var(--border);transition:background 220ms ease}
html[data-teacher-voices=preview] .teacher-voices-switch-track::after{content:'';position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background:var(--paper);box-shadow:0 1px 3px #0003;transition:transform 260ms cubic-bezier(.22,1,.36,1)}
html[data-teacher-voices=preview] .teacher-voices-toggle[aria-checked=true] .teacher-voices-switch-track{background:var(--green)}
html[data-teacher-voices=preview] .teacher-voices-toggle[aria-checked=true] .teacher-voices-switch-track::after{transform:translateX(14px)}
html[data-teacher-voices=preview] .teacher-voices-switch-state{min-width:20px;text-align:left}
html[data-teacher-voices=preview] .teacher-voices-instruction{font-size:11px;line-height:1.5;color:var(--muted);margin:12px 0 9px}
html[data-teacher-voices=preview] .teacher-voice-choices{min-width:0;padding:0;border:0;margin:0}
html[data-teacher-voices=preview] .teacher-voice-group{display:grid;gap:5px;margin:0 0 12px}
html[data-teacher-voices=preview] .teacher-voice-group h3{font-size:11px;font-weight:650;color:var(--muted);margin:2px 0 3px}
html[data-teacher-voices=preview] .teacher-voice-choice{display:flex;align-items:center;gap:10px;min-height:39px;margin:0;padding:8px 10px;border:1px solid var(--border);border-radius:10px;color:var(--ink);background:var(--paper);font-size:12px;font-weight:400;letter-spacing:0;line-height:1.4;cursor:pointer;transition:background 180ms ease,border-color 180ms ease}
html[data-teacher-voices=preview] .teacher-voice-choice:hover:not(.is-disabled){background:var(--soft)}
html[data-teacher-voices=preview] .teacher-voice-choice.is-selected{background:var(--soft);border-color:var(--green)}
html[data-teacher-voices=preview] .teacher-voice-choice.is-disabled{opacity:.6;cursor:default}
html[data-teacher-voices=preview] .teacher-voice-choice input[type=radio]{flex:0 0 15px;width:15px;height:15px;min-width:15px;min-height:15px;margin:0;padding:0;accent-color:var(--green)}
html[data-teacher-voices=preview] #teacher-voice-notice{font-size:11px;line-height:1.6;color:var(--muted);margin:0;padding-top:10px;border-top:1px solid var(--border)}
html[data-teacher-voices=preview] #teacher-voices-status{font-size:11px;line-height:1.6;color:var(--ink);margin:8px 0 0}
html[data-teacher-voices=preview] #teacher-voices-status:empty{display:none}
html[data-teacher-voices=preview] .teacher-panel-open #teacher-tooltip{display:none}
@media(prefers-reduced-motion:reduce){html[data-teacher-voices=preview] #teacher-voices,html[data-teacher-voices=preview] #teacher-voices>:not(.teacher-voices-heading),html[data-teacher-voices=preview] .teacher-voice-choice,html[data-teacher-voices=preview] .teacher-voices-toggle,html[data-teacher-voices=preview] .teacher-voices-switch-track,html[data-teacher-voices=preview] .teacher-voices-switch-track::after{transition:none}}
/* Details follow the hovered word without changing the centered page. */
.book-view #word-info,.book-view #word-info.is-review{right:auto;bottom:auto;translate:none;width:max-content;max-width:min(340px,calc(100vw - 16px));max-height:calc(100dvh - 16px);padding:10px 12px;transform-origin:center;transition:scale 320ms cubic-bezier(.2,.7,.2,1),opacity 320ms ease,display 320ms allow-discrete;}
@media(max-width:899px){
 .book-view #word-info,.book-view #word-info.is-review{padding:10px}
}
@media(prefers-reduced-motion:reduce){.book-view #word-info{transition:none}}

/* Measured page margins choose the desktop rail, not a browser-width guess.
   A top row stays in document flow so it cannot cover any Quran line. */
.book-view.book-controls-top main{padding-top:12px}
.book-view.book-controls-top .practice{position:relative;top:auto;bottom:auto;left:auto;right:auto;width:max-content;margin:0 auto 16px;padding:6px;transform:none}
.book-view.book-controls-top .recorder-main{flex-direction:row;gap:8px!important}
.book-view.book-controls-top .recorder-main>.book-control{flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;padding:8px}
.book-view.book-controls-top #teacher-tooltip{left:-52px;top:calc(100% + 14px);transform:scale(.9);transform-origin:top left}
.book-view.book-controls-top #teacher-enabled:hover #teacher-tooltip,.book-view.book-controls-top #teacher-enabled:focus-visible #teacher-tooltip{transform:scale(1)}
.book-view.book-controls-top #status,.book-view.book-controls-top #model-picker{position:absolute;top:calc(100% + 8px);left:0;width:min(320px,calc(100vw - 24px));z-index:11;margin:0}
.book-view.book-controls-top #download{position:absolute;left:12px;right:12px;bottom:2px;width:calc(100% - 24px);height:2px;margin:0}
@media(max-width:600px){
  .book-view main{padding:12px 8px 24px;margin:0}
  .book-view.book-controls-top .practice{margin-left:0;margin-right:48px;margin-bottom:12px}
  .book-view.book-controls-top .recorder-main{gap:4px!important}
  .book-view.book-controls-top #teacher-tooltip{left:-48px}
  .book-view .header .app-version{top:24px}
  .book-view .reader{padding:0 12px}
  .book-view .surah-heading{gap:4px}
  .book-view .surah-heading h2{font-size:17px}
  .book-view #surah-title{font-size:14px}
  #book-settings{padding:20px}
}
@media(prefers-reduced-motion:reduce){
  .book-view .book-control{transition:none}
  .book-view #teacher-enabled svg{animation:none}
  .book-view #teacher-tooltip{transition:none}
}

/* Test-page diagnostics stay inside settings and never cover the Mushaf. */
html[data-tajweed-review=experimental] .tajweed-testing-log{margin-top:8px;border-top:1px solid var(--border);padding-top:10px;font-size:12px}
html[data-tajweed-review=experimental] .tajweed-testing-log>summary{font-weight:650;cursor:pointer;padding:4px 0}
html[data-tajweed-review=experimental] .tajweed-log-body{display:grid;gap:10px;padding-top:10px;min-width:0}
.book-view #book-settings .tajweed-preview-settings .tajweed-log-toggle{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer;font-weight:500}
html[data-tajweed-review=experimental] .tajweed-log-toggle input{width:16px;height:16px;min-width:16px;min-height:16px;margin:0;accent-color:var(--green)}
html[data-tajweed-review=experimental] .tajweed-log-summary{margin:0;font-size:11px;line-height:1.65;color:var(--muted);overflow-wrap:anywhere}
html[data-tajweed-review=experimental] .tajweed-log-events{margin:0;padding:0;list-style:none;max-height:240px;overflow:auto;scrollbar-width:thin;display:grid;gap:7px}
html[data-tajweed-review=experimental] .tajweed-log-events li{padding:7px 8px;border:1px solid var(--border);border-radius:8px;background:var(--paper);line-height:1.5;overflow-wrap:anywhere}
html[data-tajweed-review=experimental] .tajweed-log-event-label{display:block;unicode-bidi:plaintext}
html[data-tajweed-review=experimental] .tajweed-log-events small{display:block;margin-top:3px;color:var(--muted);font-size:10px}
html[data-tajweed-review=experimental] .tajweed-log-actions{display:flex;gap:6px;flex-wrap:wrap}
html[data-tajweed-review=experimental] .tajweed-log-actions button{padding:6px 9px;font-size:11px;min-height:32px}
html[data-tajweed-review=experimental] .tajweed-log-message:empty{display:none}
html[data-tajweed-review=experimental] .tajweed-log-fallback{display:block;box-sizing:border-box;width:100%;font:10px/1.5 monospace;resize:vertical;max-height:220px}
html[data-tajweed-review=experimental] .tajweed-log-fallback[hidden]{display:none}
html[data-tajweed-review=experimental] .tajweed-log-retention{font-size:10px;color:var(--muted)}

/* Colour annotations belong to the test-page guide. Keep glyph sizing and
   word tracking separate from each letter's Tajweed colour. */
html[data-tajweed-colors=preview] .book-view{--tajweed-madd:#b5293b;--tajweed-ghunnah:#217742;--tajweed-idgham:#815aab;--tajweed-ikhfa:#267680;--tajweed-qalqalah:#2867bc;--tajweed-silent:#6d766e}
html[data-tajweed-colors=preview] .book-view.dark{--tajweed-madd:#fa9098;--tajweed-ghunnah:#76c48d;--tajweed-idgham:#c5a0eb;--tajweed-ikhfa:#78c9cf;--tajweed-qalqalah:#84b6f8;--tajweed-silent:#a1afa4}
html[data-tajweed-colors=preview] .word [data-tajweed-rule]{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit}
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=madda_normal],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=madda_permissible],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=madda_obligatory],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=madda_necessary]{color:var(--tajweed-madd)}
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=ghunnah]{color:var(--tajweed-ghunnah)}
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=idgham_ghunnah],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=idgham_wo_ghunnah],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=idgham_shafawi],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=idgham_mutajanisayn],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=idgham_mutaqaribayn]{color:var(--tajweed-idgham)}
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=ikhafa],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=ikhafa_shafawi],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=iqlab]{color:var(--tajweed-ikhfa)}
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=qalaqah]{color:var(--tajweed-qalqalah)}
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=ham_wasl],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=laam_shamsiyah],
html[data-tajweed-colors=preview] .tajweed-colors-on .word [data-tajweed-rule=slnt]{color:var(--tajweed-silent)}
html[data-tajweed-colors=preview] .tajweed-colors-on .word.matched:not(.concealed){color:var(--ink);text-decoration:underline solid;text-decoration-color:var(--green);text-decoration-thickness:1px;text-underline-offset:8px}
html[data-tajweed-colors=preview] .tajweed-colors-on .word.matched:not(.next):not(.concealed){background:color-mix(in srgb,var(--green) 9%,transparent)}
html[data-tajweed-colors=preview] .tajweed-colors-on .word.review:not(.concealed){color:var(--ink);text-decoration:underline dotted;text-decoration-color:var(--amber);text-decoration-thickness:2px;text-underline-offset:8px}
html[data-tajweed-colors=preview] .tajweed-colors-on .word.review:not(.next):not(.concealed){background:color-mix(in srgb,var(--amber) 11%,transparent)}
html[data-tajweed-colors=preview] .word.concealed [data-tajweed-rule],
html[data-tajweed-colors=preview] .word.concealed *{color:transparent!important;text-decoration:none!important;text-shadow:none!important}
/* Keep hidden words blank; ayah numbers remain visible. */
html[data-hidden-text=blank] .word.concealed::after{content:none}
html[data-hidden-text=blank] .word.concealed{background:transparent!important;box-shadow:none!important;border-color:transparent!important}
html[data-tajweed-colors=preview] #tajweed-colors-toggle{--tajweed-icon-line:var(--muted);--tajweed-icon-paper:var(--paper);padding:5px;color:var(--muted)}
html[data-tajweed-colors=preview] #tajweed-colors-toggle .tajweed-colour-symbol{width:28px;height:28px}
html[data-tajweed-colors=preview] #tajweed-colors-toggle .tajweed-icon-madd,
html[data-tajweed-colors=preview] #tajweed-colors-toggle .tajweed-icon-ghunnah,
html[data-tajweed-colors=preview] #tajweed-colors-toggle .tajweed-icon-qalqalah{stroke:var(--tajweed-icon-line);transition:stroke 220ms ease}
html[data-tajweed-colors=preview] #tajweed-colors-toggle[aria-pressed=true]{--tajweed-icon-line:var(--green);background:color-mix(in srgb,var(--green) 12%,var(--card));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--green) 40%,transparent)}
html[data-tajweed-colors=preview] #tajweed-colors-toggle[aria-pressed=true] .tajweed-icon-madd{stroke:var(--tajweed-madd)}
html[data-tajweed-colors=preview] #tajweed-colors-toggle[aria-pressed=true] .tajweed-icon-ghunnah{stroke:var(--tajweed-ghunnah)}
html[data-tajweed-colors=preview] #tajweed-colors-toggle[aria-pressed=true] .tajweed-icon-qalqalah{stroke:var(--tajweed-qalqalah)}
html[data-tajweed-colors=preview] .tajweed-colour-settings{display:grid;gap:9px}
html[data-tajweed-colors=preview] .tajweed-colour-settings .hint{margin:0;font-size:11px;line-height:1.6}
html[data-tajweed-colors=preview] .tajweed-colour-legend{display:grid;grid-template-columns:1fr 1fr;gap:8px 12px;list-style:none;margin:0;padding:0;font-size:11px}
html[data-tajweed-colors=preview] .tajweed-colour-legend li{display:flex;align-items:center;gap:7px}
html[data-tajweed-colors=preview] .tajweed-colour-swatch{width:8px;height:8px;border-radius:50%;flex:none;background:var(--tajweed-swatch)}
html[data-tajweed-colors=preview] [data-tajweed-colour=madd]{--tajweed-swatch:var(--tajweed-madd)}
html[data-tajweed-colors=preview] [data-tajweed-colour=ghunnah]{--tajweed-swatch:var(--tajweed-ghunnah)}
html[data-tajweed-colors=preview] [data-tajweed-colour=idgham]{--tajweed-swatch:var(--tajweed-idgham)}
html[data-tajweed-colors=preview] [data-tajweed-colour=ikhfa]{--tajweed-swatch:var(--tajweed-ikhfa)}
html[data-tajweed-colors=preview] [data-tajweed-colour=qalqalah]{--tajweed-swatch:var(--tajweed-qalqalah)}
html[data-tajweed-colors=preview] [data-tajweed-colour=silent]{--tajweed-swatch:var(--tajweed-silent)}
/* Six 44px controls fit in one row from 366px; smaller viewports use two
   rows rather than widening or shifting the centered Quran page. */
@media(max-width:365px){
  html[data-tajweed-colors=preview] .book-view.book-controls-top .recorder-main{display:grid;grid-template-columns:repeat(3,44px);gap:4px!important}
}
@media(prefers-reduced-motion:reduce){
  html[data-tajweed-colors=preview] #tajweed-colors-toggle .tajweed-icon-madd,
  html[data-tajweed-colors=preview] #tajweed-colors-toggle .tajweed-icon-ghunnah,
  html[data-tajweed-colors=preview] #tajweed-colors-toggle .tajweed-icon-qalqalah{transition:none}
}



