/* Signed-in browser Home. Installed Home retains its own rotary-shell owner. */
html:not(.android-webview) body.app-mode #home:not(.hidden) {
  --member-header-height: 60px;
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: calc(100svh - var(--member-header-height));
  max-width: none;
  margin: 0;
  padding: clamp(20px, 3svh, 40px) max(18px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  gap: 0;
  overflow: visible;
  background: var(--welcome-paper);
  color: var(--welcome-ink);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#home > .member-home {
  --member-utility-ink: #000;
  display: flex;
  flex-direction: column;
  flex: 1;
  width: min(100%, 1240px);
  max-width: none;
  margin: 0 auto;
  color: var(--welcome-ink);
  font-family: 'Inter', Arial, sans-serif;
  text-align: left;
}
.member-home :where(p, small, a, button, span) { font-family: 'Inter', Arial, sans-serif; }
.member-home [lang="bn"] { font-family: 'Adorsho Lipi', sans-serif; }
html:not(.android-webview) body.app-mode:has(#home:not(.hidden)) #appHeader { background: var(--welcome-paper); border-bottom: 1px solid var(--welcome-line); box-shadow: none; }
html:not(.android-webview) body.app-mode:has(#home:not(.hidden)) #appHeader .chapter-status { color: var(--welcome-ink); }
html:not(.android-webview) body.app-mode:has(#home:not(.hidden)) #appHeader .status-icon { display: none; }
.member-home *, .offer-dialog *, .join-offer * { box-sizing: border-box; }
.member-study { margin-block: auto; }
.member-welcome { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.member-welcome h1 { margin: 0; color: inherit; font: 700 clamp(25px, 3vw, 36px)/1.15 'Inter', sans-serif; letter-spacing: -.04em; }
.member-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; }
.member-library { position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: 16px; padding: clamp(20px, 3vw, 36px); background: var(--welcome-surface); border: 1px solid var(--welcome-line); border-radius: 28px; }
.member-cover, .member-entry { min-width: 0; }
.member-entry { display: grid; justify-self: center; justify-items: center; align-content: center; width: min(100%, 160px); gap: 0; }
/* The original cap has transparent margins: its brim overlaps the button, not the label.
   Extra side room keeps the hanging tassel to the left of the text at phone sizes. */
.member-animation { position: relative; z-index: 3; width: calc(100% + 32px); aspect-ratio: 1; margin-bottom: calc(-38% - 12px); transform: translateX(-12%); pointer-events: none; }
.member-animation img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.member-animation img[hidden] { display: none; }
.member-book { display: block; width: 100%; height: clamp(260px, 39svh, 420px); object-fit: contain; transform-origin: 50% 80%; animation: member-book-shake 12s ease-in-out infinite; animation-play-state: paused; }
#home[data-home-motion="running"] .member-book { animation-play-state: running; }
/* A short book-only shudder after a long rest; never shake the page or its controls. */
@keyframes member-book-shake {
  0%, 90%, 98%, 100% { transform: translate(0, 0) rotate(0); }
  91% { transform: translate(-4px, 1px) rotate(-1.4deg); }
  92% { transform: translate(4px, -1px) rotate(1.4deg); }
  93% { transform: translate(-3px, 0) rotate(-1.1deg); }
  94% { transform: translate(3px, 1px) rotate(1deg); }
  95% { transform: translate(-2px, -1px) rotate(-.7deg); }
  96% { transform: translate(2px, 0) rotate(.5deg); }
  97% { transform: translate(-1px, 0) rotate(-.3deg); }
}
.member-book[hidden], .member-book-fallback[hidden] { display: none; }
.member-book-fallback { display: grid; place-content: center; height: clamp(260px, 39svh, 420px); padding: 12px; border: 1px solid var(--welcome-line); border-radius: 10px; color: var(--welcome-muted); font: 14px/1.5 'Inter', sans-serif; text-align: center; }
.member-home .member-open {
  --member-action-light: color-mix(in srgb, var(--welcome-accent) 88%, var(--welcome-on-accent));
  --member-action-fill: radial-gradient(65.28% 65.28% at 50% 100%, var(--member-action-light) 0%, transparent 100%), linear-gradient(0deg, var(--welcome-accent), var(--welcome-accent-strong));
  position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center;
  width: 100%; min-width: 0; min-height: 60px; margin: 0; padding: 20px 8px 10px;
  overflow: hidden; border: 0; border-radius: 12px; background: var(--member-action-fill);
  color: var(--welcome-on-accent); font: 700 15px/1.5 'Inter', sans-serif;
  box-shadow: 0 5px 16px color-mix(in srgb, var(--welcome-accent) 18%, transparent);
}
.member-home .member-open::before, .member-home .member-open::after {
  content: ''; position: absolute; z-index: 0; pointer-events: none; opacity: 1; transform: none;
  width: auto; height: auto; border: 0; box-shadow: none; transition: opacity .25s ease;
}
.member-home .member-open::before { inset: 1px; border-radius: 11px; background: linear-gradient(177.95deg, color-mix(in srgb, var(--welcome-on-accent) 30%, transparent), transparent); }
.member-home .member-open::after { inset: 2px; border-radius: 10px; background: var(--member-action-fill); }
.member-home .member-open-label { position: relative; z-index: 2; font: 700 24px/1.15 'El Messiri', Georgia, serif; white-space: nowrap; }
.member-open-points { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.member-open-points i { position: absolute; bottom: -10px; width: 2px; height: 2px; border-radius: 50%; background: var(--welcome-on-accent); animation: member-floating-point 2.35s infinite ease-in-out; animation-play-state: paused; }
#home[data-home-motion="running"] .member-open-points i { animation-play-state: running; }
.member-open-points i:nth-child(1) { left: 10%; animation-delay: .2s; }
.member-open-points i:nth-child(2) { left: 30%; opacity: .7; animation-duration: 2.5s; animation-delay: .5s; }
.member-open-points i:nth-child(3) { left: 25%; opacity: .8; animation-duration: 2.2s; animation-delay: .1s; }
.member-open-points i:nth-child(4) { left: 44%; opacity: .6; animation-duration: 2.05s; }
.member-open-points i:nth-child(5) { left: 50%; animation-duration: 1.9s; }
.member-open-points i:nth-child(6) { left: 75%; opacity: .5; animation-duration: 1.5s; animation-delay: 1.5s; }
.member-open-points i:nth-child(7) { left: 88%; opacity: .9; animation-duration: 2.2s; animation-delay: .2s; }
.member-open-points i:nth-child(8) { left: 58%; opacity: .8; animation-duration: 2.25s; animation-delay: .2s; }
.member-open-points i:nth-child(9) { left: 98%; opacity: .6; animation-duration: 2.6s; animation-delay: .1s; }
.member-open-points i:nth-child(10) { left: 65%; animation-duration: 2.5s; animation-delay: .2s; }
@keyframes member-floating-point { 0% { transform: translateY(0); } 85% { opacity: 0; } 100% { transform: translateY(-65px); opacity: 0; } }
.member-links { display: grid; gap: 14px; }
.member-home .member-link { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 18px; width: 100%; min-height: 104px; margin: 0; padding: 22px; border: 1px solid var(--welcome-line); border-radius: 20px; background: var(--welcome-paper); color: var(--welcome-ink); box-shadow: none; text-align: left; }
.member-link img { width: 48px; height: 48px; object-fit: contain; }
.member-link strong, .member-link small { display: block; font-family: 'Inter', Arial, sans-serif; }
.member-link strong { margin-bottom: 6px; font-size: 18px; font-weight: 700; }
.member-link small { color: var(--welcome-muted); font-size: 13px; line-height: 1.5; }
.member-link strong:only-child { margin-bottom: 0; }
.member-home :is(button, a), .offer-dialog :is(button, a), .join-offer :is(button, a) { cursor: pointer; }
.member-home button { transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.member-home .member-link:hover { background: var(--welcome-surface); border-color: var(--welcome-accent); }
.member-home .member-open:hover { box-shadow: 0 7px 20px color-mix(in srgb, var(--welcome-accent) 27%, transparent); }
.member-home .member-open:hover::after { opacity: .85; }
.member-home .member-open:active { transform: scale(.95); }
.member-home .member-open:disabled .member-open-points { display: none; }
.member-home :is(button, a):focus-visible, .offer-dialog :is(button, a, iframe):focus-visible, .join-offer :is(button, a, iframe):focus-visible { outline: 3px solid var(--welcome-accent); outline-offset: 4px; }
.member-home button:active { transform: translateY(1px); }
.member-home button:disabled { opacity: .55; cursor: default; transform: none; }
.member-footer { display: grid; flex: 0 0 auto; justify-items: center; gap: 12px; padding: clamp(28px, 4svh, 56px) 0 0; }
/* A single in-flow dock. No fixed overlay or transformed ancestor of the profile popover. */
.member-utilities { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr); align-items: center; gap: 6px; width: min(100%, 420px); padding: 8px; border: 1px solid var(--welcome-line); border-radius: 999px; background: var(--welcome-surface); box-shadow: 0 8px 24px -12px var(--welcome-shadow); }
.member-profile-slot, .member-whatsapp-slot { display: contents; }
.member-utilities:has(#adminEntryBtn:not(.hidden)) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.45fr) minmax(0, 1fr); width: min(100%, 500px); }
.member-products { display: inline-flex; align-items: center; justify-content: center; min-height: 56px; min-width: 0; padding: 8px; border: 1px solid var(--welcome-line); border-radius: 999px; background: var(--welcome-paper); color: var(--member-utility-ink); font: 600 13px/1.25 'Inter', Arial, sans-serif; text-align: center; text-decoration: none; }
.member-products:hover { background: var(--welcome-line); border-color: var(--welcome-muted); }
.member-products:active { background: var(--welcome-surface); }
.member-utility-label { display: none; }
.member-utilities .member-utility-label { display: block; color: var(--welcome-ink); font: 600 11px/1.25 'Inter', Arial, sans-serif; }
.member-utilities #profileBtn, .member-utilities #whatsappBtn, .member-utilities #adminEntryBtn { position: static; inset: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; min-width: 44px; height: 56px; margin: 0; padding: 4px; border: 1px solid transparent; border-radius: 999px; background: transparent; box-shadow: none; transform: none; opacity: 1; z-index: auto; touch-action: manipulation; }
.member-utilities :is(#profileBtn, #whatsappBtn, #adminEntryBtn) img { width: 24px; height: 24px; object-fit: contain; }
.member-utilities #whatsappBtn img { width: 26px; height: 26px; }
.member-utilities #adminEntryBtn img { width: 28px; height: 28px; }
/* The floating contact's app-mode opacity must not dim this labelled dock item. */
.member-home .member-utilities #whatsappBtn { opacity: 1; }
.member-utilities :is(#profileBtn, #whatsappBtn, #adminEntryBtn).hidden { display: none; }
.member-utilities #adminEntryBtn:hover { border-color: var(--welcome-line); background: var(--welcome-paper); }
.member-utilities #adminEntryBtn:active { opacity: .75; }
.member-utilities #profileBtn:hover, .member-utilities #profileBtn[aria-expanded="true"] { background: var(--welcome-paper); border-color: var(--welcome-line); }
.member-utilities #profileBtn:active { background: var(--welcome-line); }
.member-utilities #whatsappBtn:hover { background: var(--welcome-paper); border-color: var(--welcome-line); }
.member-home .member-utilities #whatsappBtn:active { opacity: .7; }
.member-utilities #profilePanel { position: fixed; inset: auto; left: var(--member-panel-x, 12px); top: var(--member-panel-y, 12px); width: min(280px, var(--member-panel-max-width, calc(100vw - 36px))); max-height: var(--member-panel-max-height, calc(100dvh - 24px)); overflow-y: auto; padding: 16px; border: 1px solid var(--welcome-line); border-radius: 18px; background: var(--welcome-paper); box-shadow: 0 8px 28px var(--welcome-shadow); backdrop-filter: none; -webkit-backdrop-filter: none; animation: none; transform: none; }
.member-utilities #profilePanel::before { display: none; }
.member-utilities #profilePanel p { min-height: 0; margin: 0 0 16px; padding: 0; color: var(--welcome-ink); font: 500 14px/1.5 'Inter', Arial, sans-serif; }
.member-utilities #profilePanel p::before { display: none; }
.member-utilities #profilePanel button { min-height: 44px; margin: 0; background: var(--welcome-accent); color: var(--welcome-on-accent); box-shadow: none; }
.member-utilities #profilePanel button:hover { background: var(--welcome-accent-strong); }
.member-sponsor { display: inline-flex; align-items: center; min-height: 44px; }
.member-sponsor img { width: 132px; height: auto; filter: grayscale(1) brightness(0); opacity: .6; }
.member-sponsor:hover img { opacity: 1; }

/* One shared, lazy offer surface for Join and the dismissible Home dialog. */
.join-offer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); align-items: center; gap: clamp(24px, 5vw, 70px); max-width: 1080px; margin: 24px auto 56px; padding: clamp(18px, 3vw, 38px); background: #fff; border: 1px solid #dce8df; border-radius: 24px; color: #102419; text-align: left; }
.join-offer h2 { margin: 0 0 14px; color: inherit; font-size: clamp(26px, 3vw, 38px); }
.join-offer p { color: #647269; line-height: 1.65; max-width: 36ch; }
.offer-embed { position: relative; width: 100%; aspect-ratio: 1 / 1.503704; overflow: hidden; border-radius: 12px; background: #f1f7f3; }
.offer-embed iframe { display: block; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; }
.offer-loading { display: grid; position: absolute; inset: 0; z-index: 1; place-content: center; padding: 22px; color: #647269; font-size: 14px; line-height: 1.5; text-align: center; pointer-events: none; background: #f1f7f3; }
.offer-loading--error { gap: 16px; pointer-events: auto; }
.offer-loading--error p { margin: 0; }
.offer-loading .offer-retry { justify-self: center; width: auto; min-height: 44px; margin: 0; padding: 10px 22px; border: 1px solid var(--welcome-accent); border-radius: 12px; background: var(--welcome-paper); color: var(--welcome-accent); box-shadow: none; font: 700 14px 'Inter', sans-serif; }
.offer-loading .offer-retry:hover { background: var(--welcome-line); }
.offer-loading .offer-retry:active { background: var(--welcome-surface); }
.offer-popup-open { overflow: hidden; }
.offer-overlay { position: fixed; inset: 0; z-index: var(--layer-dialog-backdrop); display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: rgba(10, 23, 17, .58); }
.offer-dialog { width: min(100%, 440px); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); display: flex; flex-direction: column; min-height: 0; border-radius: 24px; background: #fff; color: #102419; box-shadow: 0 24px 70px #10241940; overflow: hidden; font-family: 'Inter', sans-serif; }
.offer-dialog-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px 10px 22px; border-bottom: 1px solid #dce8df; }
.offer-dialog-header h2 { margin: 0; font: 700 18px/1.3 'Inter', sans-serif; color: inherit; }
.offer-dialog .offer-close { display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; margin: 0; padding: 0; border: 1px solid #dce8df; border-radius: 50%; background: #fff; color: #102419; box-shadow: none; font: 28px/1 Arial, sans-serif; }
.offer-dialog .offer-close:hover { background: #f1f7f3; }
.offer-dialog .offer-close:active { background: #dce8df; }
.offer-dialog-body { min-height: 0; overflow-y: auto; padding: 12px 16px 0; overscroll-behavior: contain; }
.offer-dialog .offer-embed { max-width: min(100%, max(260px, calc((100dvh - 218px) / 1.503704))); margin: auto; }
.offer-dialog-footer { flex: 0 0 auto; padding: 8px 16px 16px; }
.offer-join { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 12px 16px; border-radius: 12px; background: #096228; color: #fff; font-weight: 700; font-size: 15px; text-decoration: none; }
.offer-join:hover { background: #061b0d; }
.offer-join:active { background: #102419; }
@media (max-width: 740px) {
  .member-welcome { margin-bottom: 18px; }
  .member-layout { grid-template-columns: 1fr; gap: 18px; }
  .member-library { padding: 22px 18px; gap: 12px; border-radius: 22px; }
  .member-book, .member-book-fallback { height: clamp(180px, 49vw, 280px); }
  .member-entry { width: min(100%, 140px); }
  .member-home .member-open-label { font-size: clamp(18px, 5.1vw, 20px); }
  .member-links { gap: 12px; }
  .member-home .member-link { min-height: 84px; padding: 16px; gap: 14px; }
  .member-link strong { font-size: 16px; margin-bottom: 3px; }
  .member-footer { padding-top: 28px; }
  .join-offer { grid-template-columns: 1fr; gap: 16px; }
  .join-offer .offer-embed { max-width: 360px; margin: auto; }
}
@media (max-width: 350px) {
  .member-library { padding: 18px 12px; }
  .member-utilities { gap: 4px; padding: 6px; }
  .member-products { padding-inline: 4px; font-size: 12px; }
}
@media (min-width: 741px) and (max-height: 800px) {
  .member-library { padding: 24px; }
  .member-book, .member-book-fallback { height: clamp(200px, 30svh, 260px); }
  .member-home .member-link { min-height: 88px; padding: 16px 22px; }
}
@media (max-height: 620px) {
  html:not(.android-webview) body.app-mode #home:not(.hidden) { --member-header-height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .member-book { animation: none; transform: none; }
  .member-home button, .member-home .member-open::after { transition: none; }
  .member-open-points { display: none; }
  .member-home .member-open:active { transform: none; }
}
html[data-native-motion-paused] .member-open-points { display: none; }
html[data-native-motion-paused] .member-book { animation: none; transform: none; }
html[data-native-motion-paused] .member-home .member-open:active { transform: none; }
@media (forced-colors: active) {
  .member-book { animation: none; transform: none; }
  .member-open-points, .member-home .member-open::before, .member-home .member-open::after { display: none; }
  .member-home .member-open { background: ButtonFace; color: ButtonText; box-shadow: none; }
  .member-library, .member-home button, .member-products, .offer-dialog, .offer-join { border: 1px solid ButtonText; }
  .member-products { color: LinkText; }
  .member-utilities { background: Canvas; border-color: ButtonText; box-shadow: none; }
  .member-utilities .member-utility-label { color: ButtonText; }
  .member-home :is(button, a):focus-visible, .offer-dialog :is(button, a, iframe):focus-visible, .join-offer :is(button, a, iframe):focus-visible { outline-color: Highlight; }
}
