/* सतनाम सङ्गत — app styles
   Colours are intentionally calm and non-decorative.
   Font sizes all derive from --fs so the reader's setting scales everything. */

:root{
  --fs: 18px;                 /* changed by the font-size setting */
  --bg:      #fbf7ef;
  --surface: #fffdf8;
  --surface-2:#f6eedf;
  --text:    #3a281b;
  --muted:   #796a5a;
  --accent:  #9a6829;
  --accent-soft:#f5ead8;
  --line:    #dfceb1;
  --danger:  #9a3412;
  --radius: 14px;
  --tabbar-h: 68px;

  /* brand — used by the splash and the home banner */
  --brand-purple: #2a1c5e;
  --brand-purple-2: #5b3fa0;
  --brand-orange: #ef8a5f;
  --brand-gold: #e8be62;

  color-scheme: light;
}

[data-theme="dark"]{
  --bg:      #12100d;
  --surface: #1d1914;
  --surface-2:#292117;
  --text:    #f3e8d4;
  --muted:   #c0ad91;
  --accent:  #e8be62;
  --accent-soft:#342718;
  --line:    #4b3a26;
  --danger:  #f0a882;
  color-scheme: dark;
}

*{ box-sizing: border-box; }

html,body{ margin:0; padding:0; min-height: 100%; }

body{
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Devanagari","Nirmala UI","Mangal",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  font-size: var(--fs);
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

/* ---------- top bar ---------- */
.topbar{
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .25rem;
  padding: .55rem .6rem calc(.55rem) .6rem;
  padding-top: calc(.5rem + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar__title{
  flex: 1; margin: 0;
  font-size: 1.12rem; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}
.icon-btn{
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 48px; min-height: 48px;
  background: none; border: 0; border-radius: 50%;
  color: var(--text); text-decoration: none;
  font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.icon-btn:active{ background: var(--surface-2); }
/* must beat .icon-btn's display:inline-flex, or [hidden] does nothing */
.icon-btn[hidden]{ display: none; }
#backBtn{ font-size: 2.15rem; }
#backBtn[hidden] + .topbar__title{ margin-left: 44px; }

/* ---------- layout ---------- */
.view{
  padding: 1.05rem .95rem calc(var(--tabbar-h) + 1.6rem + env(safe-area-inset-bottom)) .95rem;
  max-width: 720px; margin: 0 auto;
  min-height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom));
  outline: none;
}
.loading{ color: var(--muted); text-align: center; padding: 3rem 0; }

/* ---------- bottom tabs ---------- */
.tabbar{
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
.tab{
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar-h);
  color: var(--muted); text-decoration: none;
  font-size: .78rem;
}
.tab__ico{ width: 24px; height: 24px; line-height: 1; }
.tab__ico svg,
.tile__ico svg{
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab.is-active{ color: var(--accent); font-weight: 600; }

/* ---------- cards & lists ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem;
  margin-bottom: .85rem;
}
.card--accent{ background: var(--accent-soft); border-color: transparent; }

.eyebrow{
  font-size: .74rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 .35rem;
}
.section-title{
  font-size: 1rem; font-weight: 600; margin: 1.4rem .2rem .6rem;
}
.section-title:first-child{ margin-top: .2rem; }

.list{ list-style: none; margin: 0; padding: 0; }
.list__item{
  display: flex; align-items: center; gap: .8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 64px;
  padding: .95rem 1.05rem;
  margin-bottom: .55rem;
  color: inherit; text-decoration: none;
}
.list__item:active{ background: var(--surface-2); }
.list__body{ flex: 1; min-width: 0; }
.list__title{ font-weight: 700; line-height: 1.45; }
.list__sub{ font-size: .88rem; color: var(--muted); line-height: 1.45; }
.list__chev{ color: var(--muted); font-size: 1.4rem; }

.grid{ display: grid; grid-template-columns: repeat(3,1fr); gap: .65rem; }
.tile{
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 142px; text-align: center; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: .75rem .45rem;
  box-shadow: 0 4px 16px rgba(83,54,22,.05);
}
.tile__ico{ width: 38px; height: 38px; color: var(--accent); line-height: 1; }
.list__item .tile__ico{ flex: 0 0 auto; width: 34px; height: 34px; }
.tile__title{ font-weight: 700; margin-top: .65rem; font-size: .96rem; line-height: 1.35; }
.tile__sub{ font-size: .76rem; color: var(--muted); line-height: 1.35; margin-top: .25rem; }
@media(max-width:350px){ .grid{ grid-template-columns: 1fr 1fr; } }

/* ---------- placeholder marker ---------- */
.badge-sample{
  display: inline-block;
  background: var(--danger); color: #fff;
  font-size: .68rem; font-weight: 700; letter-spacing: .05em;
  padding: .1rem .45rem; border-radius: 999px;
  vertical-align: middle; margin-inline-start: .4rem;
}
.notice{
  background: var(--surface-2);
  border-inline-start: 4px solid var(--danger);
  border-radius: 8px;
  padding: .7rem .85rem;
  font-size: .84rem; color: var(--muted);
  margin-bottom: 1rem;
}

/* ---------- reader ---------- */
.reader h2{ font-size: 1.32rem; margin: 0 0 .2rem; line-height: 1.55; }
.reader__meta{ color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.reader__text p{ margin: 0 0 1.2rem; }
.reader__text{ font-size: 1.12em; line-height: 1.9; }
.scan{
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: .6rem; background: var(--surface);
  cursor: zoom-in;
}
.scan-hint{ font-size: .88rem; color: var(--muted); margin: 0 0 1rem; line-height: 1.5; }
audio, video{ width: 100%; margin-bottom: 1rem; border-radius: 10px; }
.audio-launch{
  width: 100%; display: flex; align-items: center; gap: .8rem;
  min-height: 64px; padding: .85rem .95rem; margin-bottom: .75rem; text-align: left;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.audio-launch__play{
  display: grid; place-items: center; width: 46px; height: 46px; flex: none;
  border-radius: 50%; background: var(--accent); color: #fff;
}
.audio-launch strong,.audio-launch small{ display: block; }
.audio-launch small{ color: var(--muted); margin-top: .1rem; }
.track-label{
  font-size: .8rem; font-weight: 600; color: var(--accent);
  margin: .2rem 0 .3rem;
}
.reader__text .gap{ height: .8rem; }

/* ---------- listen albums ---------- */
.album-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .75rem;
  margin-bottom: .9rem;
}
.album-card{
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: .65rem;
  min-height: 246px;
  padding: .75rem;
  color: inherit;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(84,50,14,.08);
}
.album-card:active{ background: var(--surface-2); }
.album-card__art{
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: #080808;
}
.album-card__art img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: .7rem;
}
.album-card__body{ min-width: 0; }
.album-card__body strong{
  display: block;
  font-size: .94rem;
  line-height: 1.4;
}
.album-card__body small{
  display: block;
  margin-top: .22rem;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.35;
}
.album-card__play{
  display: grid;
  place-items: center;
  justify-self: end;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .9rem;
}
.album-card--collection .album-card__play{
  background: var(--surface-2);
  color: var(--accent);
  font-size: 1.4rem;
}
.album-hero{
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(84,50,14,.08);
}
.album-hero__art{
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  background: #080808;
}
.album-hero__art img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: .7rem;
}
.album-hero h2{
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.35;
}
.album-hero p:last-child{
  margin: .25rem 0 0;
  color: var(--muted);
  line-height: 1.35;
}

@media(max-width:360px){
  .album-grid{ grid-template-columns: 1fr; }
  .album-card{ min-height: 0; grid-template-columns: 86px 1fr auto; grid-template-rows: auto; align-items: center; }
  .album-card__art{ width: 86px; }
  .album-card__play{ justify-self: center; }
  .album-hero{ grid-template-columns: 86px 1fr; }
}

.listen-switch{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 0 0 1rem;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.listen-switch a{
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  border-radius: 9px;
  font-size: .92rem;
}
.listen-switch a.is-on{
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  box-shadow: 0 1px 5px rgba(60,35,10,.12);
}
.playlist-list{ display: grid; gap: .55rem; }
.playlist-row{
  width: 100%;
  display: grid;
  grid-template-columns: 58px 1fr 42px;
  align-items: center;
  gap: .75rem;
  min-height: 74px;
  padding: .6rem .75rem;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  cursor: pointer;
}
.playlist-row:active{ background: var(--surface-2); }
.playlist-row__art{
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border-radius: 10px;
  background: #080808;
}
.playlist-row__art img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: .35rem;
}
.playlist-row__body{ min-width: 0; }
.playlist-row__body strong{
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}
.playlist-row__body small{
  display: block;
  margin-top: .1rem;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}
.playlist-row__play{
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .9rem;
}

.actionbar{ display: flex; gap: .5rem; flex-wrap: wrap; margin: 1.2rem 0 .5rem; }
.btn{
  appearance: none; cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  min-height: 46px; padding: .62rem 1rem; font: inherit; font-size: .94rem;
  text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
}
.btn--primary{ background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.is-on{ background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---------- search ---------- */
.search-field{
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: .75rem 1.1rem; margin-bottom: 1rem;
}
.search-field:focus{ outline: 2px solid var(--accent); outline-offset: 1px; }
mark{ background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 .1em; }

/* ---------- settings ---------- */
.setting{
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 0; border-bottom: 1px solid var(--line);
}
.setting:last-child{ border-bottom: 0; }
.setting__label{ font-weight: 600; }
.setting__hint{ font-size: .9rem; color: var(--muted); line-height: 1.45; }
.language-note{ margin: -.25rem 0 1rem; padding: .65rem .75rem; background: var(--surface-2); border-radius: 10px; }
.seg{ display: flex; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button{
  appearance: none; background: var(--surface); border: 0; color: var(--text);
  min-height: 42px; font: inherit; font-size: .86rem; line-height: 1.2;
  padding: .45rem .72rem; cursor: pointer; white-space: nowrap;
}
.seg button.is-on{ background: var(--accent); color: #fff; font-weight: 600; }
.seg--wide{ border-radius: 12px; }

@media(max-width:520px){
  .setting{ align-items: stretch; flex-direction: column; gap: .55rem; }
  .seg{ width: 100%; }
  .seg button{ flex: 1; min-width: 0; padding-left: .45rem; padding-right: .45rem; }
}

/* ---------- lightbox ---------- */
.lightbox{
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.94);
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden]{ display: none; }
.lightbox__scroll{
  width: 100%; height: 100%; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  touch-action: pinch-zoom;
}
.lightbox__scroll img{ max-width: 100%; height: auto; }
.lightbox__tools{
  position: absolute; left: 50%; bottom: calc(.8rem + env(safe-area-inset-bottom));
  z-index: 2; transform: translateX(-50%);
  display: flex; align-items: center; overflow: hidden;
  background: rgba(20,16,12,.9); border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.lightbox__tools button{
  min-width: 50px; min-height: 46px; padding: 0 .8rem;
  border: 0; border-right: 1px solid rgba(255,255,255,.18);
  background: transparent; color: #fff; font: inherit; cursor: pointer;
}
.lightbox__tools button:last-child{ border-right: 0; }
.lightbox__close{
  position: absolute; top: calc(.6rem + env(safe-area-inset-top)); right: .6rem;
  z-index: 1; width: 44px; height: 44px;
  background: rgba(255,255,255,.15); color: #fff;
  border: 0; border-radius: 50%; font-size: 1.2rem; cursor: pointer;
}

/* ---------- persistent audio player ---------- */
.mini-player{
  position: fixed; z-index: 25;
  left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: .7rem .8rem .8rem; background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0,0,0,.12);
}
.mini-player[hidden]{ display: none; }
.mini-player__info{ display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; }
.mini-player__art{
  width: 44px; height: 44px; flex: none; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px;
  background: #080808; cursor: pointer;
}
.mini-player__art img{ display: block; width: 100%; height: 100%; object-fit: cover; }
.mini-player__title{ flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .88rem; font-weight: 700; line-height: 1.3; }
.mini-player__close{ width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font: inherit; font-size: 1.45rem; line-height: 1; cursor: pointer; }
.mini-player__timeline{ display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: .55rem; margin: .15rem 0 .55rem; color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.mini-player__timeline input{ width: 100%; accent-color: var(--accent); }
.mini-player__controls{ display: grid; grid-template-columns: 46px 52px 58px 52px 46px; justify-content: center; align-items: center; gap: .45rem; }
.mini-player__skip,
.mini-player__seek,
.mini-player__play{
  min-width: 44px; min-height: 44px; flex: none;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font: inherit; font-weight: 700; line-height: 1;
}
.mini-player__seek{ width: 52px; height: 46px; border-radius: 999px; font-size: .78rem; }
.mini-player__play{ width: 58px; height: 58px; background: var(--accent); border-color: var(--accent); color: #fff; font-size: 1.2rem; box-shadow: 0 6px 18px rgba(84,50,14,.22); }
.mini-player__skip:disabled{ opacity: .35; }
.mini-player audio{ display: none; }
.has-player .view{ padding-bottom: calc(var(--tabbar-h) + 10.8rem + env(safe-area-inset-bottom)); }

/* ---------- full audio player ---------- */
.full-player{
  position: fixed; inset: 0; z-index: 80;
  background: #5d4325; color: #fff;
}
.full-player[hidden]{ display: none; }
.full-player__shade{
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 50% 10%, rgba(232,190,98,.28), transparent 34%),
    linear-gradient(160deg, rgba(42,28,94,.34), transparent 42%),
    linear-gradient(180deg, rgba(154,104,41,.95), rgba(54,40,23,.98));
}
.full-player__panel{
  position: relative; z-index: 1;
  min-height: 100dvh; max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: calc(1rem + env(safe-area-inset-top)) 1.5rem calc(1.2rem + env(safe-area-inset-bottom));
}
.full-player__close{
  align-self: center; width: 56px; height: 32px; margin-bottom: 1rem;
  border: 0; border-radius: 999px; background: rgba(255,255,255,.18);
  color: #fff; font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.full-player__art{
  width: min(72vw, 340px); aspect-ratio: 1 / 1; object-fit: contain;
  align-self: center; margin: 1rem 0 2rem; padding: 1.1rem;
  border-radius: 18px; background: #080808;
  box-shadow: 0 20px 55px rgba(0,0,0,.34);
}
.full-player__meta{ display: grid; grid-template-columns: 1fr; gap: .2rem; margin-bottom: 1.1rem; }
.full-player__meta h2{ margin: 0; font-size: 1.35rem; line-height: 1.3; }
.full-player__meta p{ margin: 0; color: rgba(255,255,255,.72); line-height: 1.35; }
.full-player__timeline{ color: rgba(255,255,255,.72); }
.full-player__timeline input{ accent-color: #fff; }
.full-player__controls{ margin: .7rem 0 1.1rem; }
.full-player .mini-player__skip,
.full-player .mini-player__seek{
  border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.12); color: #fff;
}
.full-player .mini-player__play{
  background: #fff; border-color: #fff; color: #5c3b1f; box-shadow: 0 8px 24px rgba(0,0,0,.28);
}
.full-player__lyrics{
  flex: 1; min-height: 110px; overflow: auto;
  padding: .95rem 1rem; border-radius: 14px;
  background: rgba(255,255,255,.11); color: rgba(255,255,255,.9);
  -webkit-overflow-scrolling: touch;
}
.full-player__lyrics h3{ margin: 0 0 .6rem; font-size: .9rem; color: rgba(255,255,255,.78); }
.full-player__lyrics p{ margin: 0 0 .85rem; line-height: 1.65; }
.full-player__empty{ color: rgba(255,255,255,.72); }
body.full-player-open{ overflow: hidden; }

@media(max-width:380px){
  .full-player__panel{ padding-left: 1rem; padding-right: 1rem; }
  .full-player__art{ width: min(78vw, 300px); margin-bottom: 1.4rem; }
  .full-player__controls{ grid-template-columns: 42px 48px 56px 48px 42px; gap: .35rem; }
}

.empty{ text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* ---------- पोथी reader ---------- */
.pothi-editions{ display: grid; gap: .7rem; }
.edition-card{
  display: flex; align-items: center; gap: .8rem;
  padding: 1rem; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.edition-card:active{ background: var(--surface-2); }
.edition-card__book{ font-size: 2rem; color: var(--accent); }
.edition-card__body{ flex: 1; min-width: 0; }
.edition-card__body strong,
.edition-card__body small{ display: block; }
.edition-card__body small{ color: var(--muted); font-size: .78rem; margin-top: .18rem; }
.pothi__bar{
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; margin-bottom: .6rem;
}
.pothi__count{ font-size: .85rem; color: var(--muted); }
.pothi__identity{ display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin: 0 0 .65rem; }
.pothi__identity strong{ font-size: 1.05rem; }
.pothi__identity small{ color: var(--muted); white-space: nowrap; }
.pothi__bookmark span{ display: none; }
.pothi__bookmark.is-on{ background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pothi__status{ display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.pothi__progress{ height: 4px; overflow: hidden; margin: .35rem 0 .6rem; background: var(--surface-2); border-radius: 999px; }
.pothi__progress i{ display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.pothi__modes{ display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: .6rem; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.pothi__modes button{ min-height: 46px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: .92rem; cursor: pointer; }
.pothi__modes button.is-on{ background: var(--surface); color: var(--text); box-shadow: 0 1px 5px rgba(60,35,10,.12); font-weight: 600; }

.pothi__viewport{ width: 100%; overflow-x: hidden; overflow-y: visible; overscroll-behavior-x: contain; border-radius: 8px; scrollbar-width: thin; }
.pothi__sheet{ position: relative; width: 100%; transform-origin: center; }
.pothi__sheet.is-dragging{ transition: none !important; }

/* white page on a dark mat, so the paper reads as paper in either theme */
.pothi__page{
  display: block; width: 100%; height: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: zoom-in;
  /* the scans are 1-bit; keep the browser from softening the strokes */
  image-rendering: -webkit-optimize-contrast;
  user-select: none; -webkit-user-drag: none;
}
.pothi.is-reading .pothi__sheet{ min-width: 0; }
.pothi--bidh.is-reading .pothi__sheet{ min-width: 0; }
.pothi.is-full-page .pothi__sheet{ min-width: 0; }
.pothi__sheet.turn-out-next{ animation: slideOutNext .16s ease-in forwards; will-change: transform, opacity; }
.pothi__sheet.turn-out-prev{ animation: slideOutPrev .16s ease-in forwards; will-change: transform, opacity; }
.pothi__sheet.turn-in-next{ animation: slideInNext .18s ease-out both; will-change: transform, opacity; }
.pothi__sheet.turn-in-prev{ animation: slideInPrev .18s ease-out both; will-change: transform, opacity; }
[data-motion="book"] .pothi__sheet.turn-out-next{ animation-name: pageOutNext; animation-duration: .24s; animation-timing-function: cubic-bezier(.4,0,.7,1); }
[data-motion="book"] .pothi__sheet.turn-out-prev{ animation-name: pageOutPrev; animation-duration: .24s; animation-timing-function: cubic-bezier(.4,0,.7,1); }
[data-motion="book"] .pothi__sheet.turn-in-next{ animation-name: pageInNext; animation-duration: .28s; animation-timing-function: cubic-bezier(.2,.75,.25,1); }
[data-motion="book"] .pothi__sheet.turn-in-prev{ animation-name: pageInPrev; animation-duration: .28s; animation-timing-function: cubic-bezier(.2,.75,.25,1); }
[data-motion="none"] .pothi__sheet.turn-out-next,
[data-motion="none"] .pothi__sheet.turn-out-prev,
[data-motion="none"] .pothi__sheet.turn-in-next,
[data-motion="none"] .pothi__sheet.turn-in-prev{ animation: none; }
@keyframes slideOutNext{ to{ transform: translateX(-12%); opacity: 0; } }
@keyframes slideOutPrev{ to{ transform: translateX(12%); opacity: 0; } }
@keyframes slideInNext{ from{ transform: translateX(12%); opacity: 0; } }
@keyframes slideInPrev{ from{ transform: translateX(-12%); opacity: 0; } }
@keyframes pageOutNext{ to{ transform: perspective(1000px) translateX(-24%) rotateY(-8deg); opacity: 0; } }
@keyframes pageOutPrev{ to{ transform: perspective(1000px) translateX(24%) rotateY(8deg); opacity: 0; } }
@keyframes pageInNext{ from{ transform: perspective(1000px) translateX(22%) rotateY(6deg); opacity: 0; } }
@keyframes pageInPrev{ from{ transform: perspective(1000px) translateX(-22%) rotateY(-6deg); opacity: 0; } }
.pothi__hint{ margin: .5rem 0 .8rem; text-align: center; }
.pothi__exit-full{
  position: fixed; right: .8rem; top: calc(.8rem + env(safe-area-inset-top)); z-index: 70;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border: 1px solid rgba(255,255,255,.38); border-radius: 50%;
  background: rgba(20,16,12,.72); color: #fff;
  font: inherit; font-size: 2rem; line-height: 1; font-weight: 400;
  box-shadow: 0 8px 24px rgba(0,0,0,.32); cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.pothi__exit-full[hidden]{ display: none; }

body.pothi-immersive{ background: #111; overflow-x: hidden; }
body.pothi-immersive .topbar,
body.pothi-immersive .tabbar,
body.pothi-immersive .mini-player{ display: none !important; }
body.pothi-immersive .view{
  max-width: none; min-height: 100dvh; margin: 0; padding: 0;
  background: #111;
}
body.pothi-immersive .pothi > :not(.pothi__viewport):not(.pothi__exit-full){ display: none; }
body.pothi-immersive .pothi__viewport{
  width: 100vw; min-height: 100dvh; overflow: auto; border-radius: 0;
  background: #111; scroll-snap-type: y proximity;
}
body.pothi-immersive .pothi__sheet{ width: 100%; min-width: 0 !important; margin: auto; scroll-snap-align: start; }
body.pothi-immersive .pothi__page{ width: 100%; border: 0; border-radius: 0; }
body.pothi-immersive .pothi__exit-full{
  right: .75rem; top: calc(.75rem + env(safe-area-inset-top));
}

.pothi__nav{
  display: flex; gap: .55rem; align-items: center;
  padding: .35rem 0; margin-bottom: .5rem;
}
.pothi__nav .btn{ flex: 1; justify-content: center; }
.pothi__nav .btn:disabled{ opacity: .4; }
#pothiJump{ flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.pothi__notice{ margin: .8rem 0 0; padding: .75rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; font-size: .78rem; line-height: 1.55; }

.page-sheet{ position: fixed; inset: 0; z-index: 60; }
.page-sheet[hidden]{ display: none; }
.page-sheet__backdrop{ position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.page-sheet__panel{
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.2);
}
.page-sheet__panel h2{ margin: 0 0 .7rem; font-size: 1.05rem; }
.page-sheet__panel label{ display: block; color: var(--muted); font-size: .8rem; }
.page-sheet__panel input{ width: 100%; margin: .35rem 0 .8rem; padding: .7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.page-sheet__panel > div{ display: flex; justify-content: flex-end; gap: .5rem; }
.btn--primary{ background: var(--accent); border-color: var(--accent); color: #fff; }

.continue-pothi-wrap{ display: grid; gap: .55rem; margin: .85rem 0; }
.continue-pothi{ display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .7rem; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none; }
.continue-pothi__icon{ color: var(--accent); font-size: 1.5rem; }
.continue-pothi strong,.continue-pothi small{ display: block; }
.continue-pothi small{ margin-top: .12rem; color: var(--muted); font-size: .75rem; }

/* index: each row is the heading exactly as printed */
.list--idx{ display: flex; flex-direction: column; gap: .45rem; }
.pothi-idx{
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 58px;
  padding: .5rem .65rem;
  text-decoration: none;
}
.pothi-idx:active{ background: var(--surface-2); }
.pothi-idx img{
  flex: 1; min-width: 0; max-width: 100%;
  height: 38px; object-fit: contain; object-position: left center;
  /* strips are black-on-white; invert them in dark mode so they sit on the card */
  background: #fff; border-radius: 4px;
  filter: contrast(1.12);
}
[data-theme="dark"] .pothi-idx img{ filter: invert(1) contrast(1.12); background: transparent; }
.pothi-idx__pg{
  flex: 0 0 auto;
  min-width: 2.7rem;
  text-align: right;
  font-size: .86rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- brand mark (splash + home banner) ---------- */
.brandmark{ width: 100%; }
.brandmark__svg,
.brandmark__img{
  display: block;
  width: 100%; height: auto;
  max-width: 100%;
}
.wordmark{ display: grid; justify-items: center; color: #4a2c19; }
.wordmark__text{ font-size: clamp(2.15rem,11vw,3.5rem); font-weight: 500; line-height: 1.25; white-space: nowrap; }
.wordmark__divider{ width: min(230px,72%); display: flex; align-items: center; gap: .45rem; color: #b98532; }
.wordmark__divider i{ height: 1px; background: currentColor; flex: 1; }
.wordmark__divider b{ font-size: .8rem; font-weight: 400; }

/* ---------- opening screen ---------- */
.splash{
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem .75rem calc(2rem + env(safe-area-inset-bottom));
  background: #080808;
  color: #e8be62;
  transition: opacity .45s ease, visibility .45s;
}
.splash.is-gone{ opacity: 0; visibility: hidden; pointer-events: none; }

.splash__inner{
  width: 100%; max-width: 540px;
  text-align: center;
}
.splash .brandmark{ animation: markIn 1.1s cubic-bezier(.2,.7,.3,1) both; }
.splash .splash-logo{ width: 100%; max-width: 720px; margin: 0 auto; }

.splash__tag{
  margin-top: .4rem;
  font-size: .95rem; font-weight: 500;
  letter-spacing: .04em;
  color: #d8b76f;
  animation: tagIn .8s .5s ease-out both;
}
.splash__skip{
  position: absolute; left: 0; right: 0;
  bottom: calc(1.6rem + env(safe-area-inset-bottom));
  text-align: center;
  font-size: .74rem; letter-spacing: .06em;
  color: #9c875f;
  animation: tagIn .6s 1.4s ease-out both;
}

@keyframes markIn{
  from{ opacity: 0; transform: scale(.88); filter: blur(6px); }
  to  { opacity: 1; transform: none;       filter: none; }
}
@keyframes tagIn{ from{ opacity: 0; transform: translateY(8px); } to{ opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce){
  .splash .brandmark, .splash__tag, .splash__skip{ animation: none; }
  .pothi__sheet.turn-out-next, .pothi__sheet.turn-out-prev,
  .pothi__sheet.turn-in-next, .pothi__sheet.turn-in-prev{ animation: none; }
}

@media(max-width:520px){
  .grid{ grid-template-columns: 1fr 1fr; }
}

@media(max-width:380px){
  .pothi__identity{ align-items: flex-start; flex-direction: column; line-height: 1.35; }
  .pothi__identity small{ white-space: normal; }
  .pothi__bar .btn{ padding-left: .65rem; padding-right: .65rem; }
  .pothi__nav{ gap: .35rem; }
  .pothi__nav .btn{ padding-left: .55rem; padding-right: .55rem; font-size: .86rem; }
}

/* ---------- home banner ---------- */
.banner{
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  padding: 1.4rem 1rem 1.1rem;
  margin-bottom: 1rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(84,50,14,.12);
}
.banner .brandmark{ max-width: 320px; margin: 0 auto; }
.banner__tag{
  margin-top: .35rem;
  font-size: .8rem; color: var(--muted);
}

/* ---------- Sadh Sangat introduction ---------- */
.legacy-panel,
.sadh-hero,
.sadh-section{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(84,50,14,.08);
}
.legacy-panel{
  padding: 1.05rem;
  margin: 0 0 1rem;
}
.legacy-panel h2,
.sadh-hero h2{
  margin: 0 0 .55rem;
  font-size: 1.18rem;
  line-height: 1.45;
}
.legacy-panel p,
.sadh-hero p,
.sadh-section p{
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.legacy-actions{
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .9rem;
}
.sadh-page{ display: grid; gap: .75rem; }
.sadh-hero{
  padding: 1.15rem;
  overflow: hidden;
}
.sadh-hero__mark{
  max-width: 240px;
  margin: 0 auto 1rem;
}
.sadh-hero__mark .wordmark__text{ font-size: clamp(1.75rem,9vw,2.7rem); }
.principle-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: .5rem;
}
.principle-grid span{
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.25;
}
.sadh-section{ padding: 1rem 1.05rem; }
.sadh-section h3{
  margin: 0 0 .35rem;
  font-size: 1rem;
  line-height: 1.45;
}
.source-note{
  margin: .15rem 0 0;
  padding: .75rem .85rem;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.55;
}

@media(max-width:380px){
  .legacy-actions .btn{ flex: 1 1 100%; justify-content: center; }
  .principle-grid{ grid-template-columns: 1fr; }
}

/* ---------- Mantra time ---------- */
.mantra-card,
.mantra-hero,
.mantra-time,
.mantra-table{
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(42,28,94,.12);
}
.mantra-card{
  min-height: 176px;
  margin: 0 0 1rem;
  color: #fff;
  background: #3b2a51;
}
.mantra-card__body{
  position: relative;
  z-index: 1;
  padding: 1.05rem;
}
.mantra-card .eyebrow{ color: rgba(255,255,255,.72); }
.mantra-card h2{
  margin: 0 0 .25rem;
  font-size: 1.35rem;
  line-height: 1.35;
}
.mantra-card p{ margin: 0 0 .85rem; color: rgba(255,255,255,.78); }
.mantra-page{ display: grid; gap: .8rem; }
.mantra-hero{
  min-height: 260px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
  background: #422855;
}
.mantra-hero__scene{ position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; }
.mantra-hero .eyebrow,
.mantra-hero h2,
.mantra-hero p{ position: relative; z-index: 1; }
.mantra-hero .eyebrow{ color: rgba(255,255,255,.7); }
.mantra-hero h2{ margin: 0; font-size: 1.8rem; line-height: 1.25; }
.mantra-hero p{ margin: .25rem 0 0; color: rgba(255,255,255,.78); }
.mantra-duo{ display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.mantra-location{
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.mantra-location .setting__hint{
  flex: 1 1 100%;
  min-height: 1.2em;
}
.mantra-location [data-mantra-city]{
  flex: 0 1 auto;
  min-height: 40px;
  padding-inline: .85rem;
}
.mantra-time{
  min-height: 156px;
  padding: .95rem;
  color: #fff;
  display: flex;
  align-items: flex-end;
}
.mantra-time > div:last-child{ position: relative; z-index: 1; }
.mantra-time p,
.mantra-time small{ display: block; margin: 0; color: rgba(255,255,255,.75); line-height: 1.35; }
.mantra-time strong{ display: block; margin: .15rem 0; font-size: 1.65rem; line-height: 1.1; }
.mantra-table{
  display: grid;
  background: var(--surface);
}
.mantra-row{
  display: grid;
  grid-template-columns: 2.4rem 1fr 4.2rem;
  align-items: center;
  min-height: 46px;
  padding: .35rem .75rem;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.mantra-row:last-child{ border-bottom: 0; }
.mantra-row span:nth-child(2){ color: var(--muted); }
.mantra-row strong{ text-align: right; font-size: 1.08rem; }
.mantra-row.is-today{
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.mantra-sky{
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.mantra-sky--morning{
  background:
    radial-gradient(circle at 72% 24%, rgba(255,247,194,.95) 0 8%, rgba(255,210,119,.45) 9% 18%, transparent 19%),
    linear-gradient(180deg, #f7b36f 0%, #d88a72 46%, #705178 100%);
}
.mantra-sky--evening{
  background:
    radial-gradient(circle at 23% 25%, rgba(255,255,255,.9) 0 1px, transparent 2px),
    radial-gradient(circle at 68% 18%, rgba(255,255,255,.75) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 46%, rgba(255,255,255,.65) 0 1px, transparent 2px),
    linear-gradient(180deg, #5b3fa0 0%, #6f4a45 50%, #2a1c35 100%);
}
.mantra-sky i,
.mantra-sky b{
  position: absolute;
  display: block;
  border-radius: 50%;
}
.mantra-sky--morning i{
  left: -12%;
  right: -12%;
  bottom: -28%;
  height: 54%;
  background: rgba(255,236,182,.2);
}
.mantra-sky--morning b{
  left: 10%;
  right: 14%;
  bottom: 20%;
  height: 2px;
  background: rgba(255,255,255,.28);
}
.mantra-sky--evening i{
  width: 42%;
  height: 42%;
  right: -16%;
  top: -14%;
  background: rgba(232,190,98,.18);
}
.mantra-sky--evening b{
  left: 12%;
  right: 16%;
  bottom: 18%;
  height: 1px;
  background: rgba(255,255,255,.22);
}

@media(max-width:520px){
  .mantra-duo{ grid-template-columns: 1fr; }
  .mantra-location .btn{ flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: no-preference){
  .view{ animation: fade .18s ease-out; }
  @keyframes fade{ from{ opacity: 0; transform: translateY(4px); } to{ opacity: 1; transform: none; } }
}
