@font-face { font-family: Cinzel; src: url(fonts/Cinzel.ttf); font-weight: 400 900; font-display: swap }
@font-face { font-family: Inter; src: url(fonts/Inter.ttf); font-weight: 100 900; font-display: swap }
@font-face { font-family: Devanagari; src: url(fonts/NotoSansDevanagari.ttf); font-weight: 100 900; font-display: swap }
:root {
  color-scheme: dark;
  --background: #0f1016;
  --surface: #181a23;
  --gold: #d4af37;
  --text: #e2e8f0;
  --muted: #9aa0ae;
  --outline: #ffffff14;
  --reader-width: 580px;
  --reading-scale: 1;
  background: var(--background);
  color: var(--text);
  font: 15px/1.5 Inter, Devanagari, system-ui, sans-serif;
}
* { box-sizing: border-box }
body { margin: 0; overflow: hidden; height: 100dvh; display: flex; flex-direction: column }
[hidden] { display: none !important }
h1, h2, p { margin: 0 }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation }
button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px }
#reader {
  width: min(100%, var(--reader-width));
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 0 auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  overscroll-behavior-y: contain;
}
.verse {
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: max(16px, env(safe-area-inset-top)) 24px max(16px, env(safe-area-inset-bottom));
}
.verse-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 8px }
.chapter-title, .verse-ref, #panel-title, .chapter-number {
  font: 700 12px/1.35 Cinzel, Devanagari, serif;
  letter-spacing: 1.5px;
  color: var(--gold);
}
.verse-ref { font-size: 13px; flex-shrink: 0 }
html[lang=hi] :is(.chapter-title, .verse-ref, #panel-title) { font: 600 14px/1.4 Devanagari, sans-serif; letter-spacing: normal }
.chapter-sanskrit { margin-top: 2px; color: var(--muted); font: 600 13px/1.4 Devanagari, sans-serif }
.verse-body { overflow: auto; scrollbar-width: thin }
.verse-inner { min-height: 100%; display: flex; flex-direction: column; justify-content: center; text-align: center }
.sanskrit {
  font: 600 calc(22px * var(--reading-scale))/1.8 Devanagari, sans-serif;
  color: white;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.announcement { font-size: calc(16px * var(--reading-scale)); color: var(--gold); padding-block: 6px }
.iast {
  margin-top: 16px;
  font: italic 400 calc(13px * var(--reading-scale))/1.4 Inter, sans-serif;
  color: var(--muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.translation {
  margin-top: 24px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: #ffffff0a;
  font-size: calc(15px * var(--reading-scale));
}
.note { color: var(--muted); font-size: calc(12px * var(--reading-scale)); line-height: 1.3; font-style: italic; margin-block: 4px }
html[lang=hi] .note { font-style: normal }
.draft { margin-top: 12px }
.inline-link { padding: 0; display: inline; text-decoration: underline; text-decoration-color: #d4af3799; text-underline-offset: 3px }
.text-button { color: var(--gold); min-height: 44px; padding: 8px 12px }
.actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 8px }
.action {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 1px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
  border-radius: 12px;
}
.action span { text-align: center; overflow-wrap: anywhere }
.action:hover { background: #ffffff0a }
.action[aria-pressed=true] { color: var(--gold) }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round }
.action[aria-pressed=true] .icon { fill: currentColor }
#hint {
  position: fixed;
  bottom: calc(96px + var(--panel-height, 0px) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 48px);
  border: 1px solid #d4af3766;
  border-radius: 24px;
  background: #181a23eb;
  padding: 10px 16px;
  font-size: 13px;
  pointer-events: none;
}
#hint span { color: var(--gold); margin-right: 8px }
.app-panel {
  width: min(100%, var(--reader-width));
  margin: 0 auto;
  padding: 10px 8px max(10px, env(safe-area-inset-bottom)) 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--outline);
  background: var(--surface);
  font-size: 12px;
  line-height: 1.35;
}
.app-panel p { flex: 1; color: var(--muted) }
.app-links { display: flex; gap: 6px; flex: none }
.app-links a { display: flex; align-items: center; text-decoration: none; font-size: 13px }
.app-close { flex: none; width: 36px; height: 44px; font-size: 20px; color: var(--muted) }
dialog {
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  padding: 0 0 env(safe-area-inset-bottom);
  width: min(100%, var(--reader-width));
  max-width: 100%;
  max-height: 95dvh;
  height: var(--sheet-height, auto);
  border: 0;
  border-radius: 28px 28px 0 0;
  color: var(--text);
  background: var(--surface);
}
dialog[open] { display: flex; flex-direction: column }
dialog::backdrop { background: #0009 }
#handle { position: relative; width: 100%; height: 40px; flex: none; touch-action: none }
#handle::after { content: ''; position: absolute; left: calc(50% - 16px); top: 18px; width: 32px; height: 4px; border-radius: 4px; background: #9aa0ae80 }
#panel-title { margin: 0 20px 8px }
#panel-content { overflow: auto; overscroll-behavior: contain; padding: 0 20px 16px }
.chapter { border-bottom: 1px solid var(--outline) }
.chapter summary { display: flex; align-items: center; gap: 14px; padding: 12px 0; min-height: 64px; cursor: pointer; list-style: none }
.chapter summary::-webkit-details-marker { display: none }
.chapter summary::after { content: '⌄'; margin-left: auto; color: var(--muted) }
.chapter[open] summary::after { transform: rotate(180deg) }
.chapter-number { font-size: 15px; min-width: 28px; text-align: center }
.chapter small, .muted { display: block; color: var(--muted); font-size: 12px }
.verse-grid, .chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 16px }
.verse-number, .chip {
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  font-size: 14px;
}
.verse-number[aria-current=true], .filled { background: var(--gold); color: var(--background); font-weight: 700 }
.tabs { display: flex; gap: 8px; overflow: auto; margin-bottom: 16px; padding-block: 4px }
.tab, .chip, .filled { min-height: 36px; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--outline); white-space: nowrap }
.tab[aria-pressed=true] { color: var(--gold); background: #d4af3721; border-color: #d4af3770 }
.study-body { font-size: 16px; line-height: 1.6 }
.study-body > * + *, #panel-content > p + p { margin-top: 10px }
.word { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--outline) }
.word strong { font-family: Devanagari, sans-serif; color: var(--gold) }
.lock { border: 1px solid var(--outline); padding: 12px; border-radius: 12px; margin-top: 12px }
.hints h3 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted) }
.hints p { font-size: 14px; margin: 0 0 6px }
.hints p::before { content: '🔒'; filter: grayscale(1); opacity: .6; margin-right: 8px; font-size: 11px }
.hints .text-button { padding-left: 0 }
.option { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 56px; padding: 0 4px; font-size: 16px; text-align: left }
.option::before { content: ''; width: 20px; height: 20px; flex: none; border: 2px solid var(--muted); border-radius: 50% }
.option[aria-checked=true]::before { border-color: var(--gold); background: radial-gradient(var(--gold) 45%, transparent 50%) }
.segmented { display: flex; margin: 8px 0 20px; border: 1px solid var(--muted); border-radius: 24px; overflow: hidden }
.segmented button { flex: 1; min-height: 40px }
.segmented button[aria-pressed=true] { background: #d4af3733; color: var(--gold) }
.settings-row, .range { display: flex; justify-content: space-between; align-items: center; gap: 12px }
.settings-row { margin: 12px 0 }
.range input { flex: 1 }
input { accent-color: var(--gold) }
.share-row { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; width: min(100%, 270px); margin: 8px auto 0; scrollbar-width: none }
.share-row::-webkit-scrollbar { display: none }
.share-preview { display: block; flex: 0 0 100%; width: 100%; scroll-snap-align: center; border: 1px solid var(--outline); border-radius: 12px }
.share-dots { display: flex; justify-content: center; gap: 8px; min-height: 8px; margin: 10px 0 16px }
.share-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--outline) }
.share-dots span.current { background: var(--gold) }
.share-choices { margin-bottom: 12px }
.tab.locked { opacity: .6; cursor: not-allowed }
.tab.locked::before { content: '🔒'; filter: grayscale(1); margin-right: 6px; font-size: 11px }
.share-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px }
#loading { min-height: 100%; display: grid; place-items: center; color: var(--gold) }
/* The page's own text: what a search engine reads, and what shows until the reader starts. */
#static { min-height: 100%; padding: 24px; display: flex; flex-direction: column; justify-content: center; gap: 16px; text-align: center }
#static h1 { font: 700 13px/1.35 Cinzel, Devanagari, serif; letter-spacing: 1.5px; color: var(--gold) }
#static h2 { font-size: 13px; color: var(--gold); margin-top: 8px }
#static a { color: var(--gold) }
#static ol { text-align: left; margin: 0 auto; line-height: 2 }
#static .translation { margin-top: 0; text-align: center }
#static nav { display: flex; justify-content: space-between; font-size: 13px }
@media (max-width: 360px) { .verse { padding-inline: 16px } .action { font-size: 10px } }
/* Pro: paywall, trial and restore (SPEC 4.3) */
.pro-preview { border: 1px solid var(--outline); border-radius: 12px; padding: 12px 14px; margin: 12px 0; max-height: 7.5em; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent) }
.pro-preview h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--gold) }
.pro-preview p { margin: 0; font-size: 15px }
.pro-points { margin: 12px 0 16px; padding-left: 20px; font-size: 15px; line-height: 1.5 }
.pro-points li { margin-bottom: 4px }
.pro-points li::marker { color: var(--gold) }
.pro-actions { display: grid; gap: 14px }
.pro-trial, .pro-buy { display: grid; gap: 4px; justify-items: center; text-align: center }
.pro-trial > .filled, .pro-buy > .filled, .pro-buy > .chip, .pro-form .filled { width: 100%; min-height: 48px; font-size: 16px }
.pro-form { display: grid; gap: 10px; width: 100% }
.field { display: grid; gap: 4px; text-align: left; font-size: 13px; color: var(--muted) }
.field input { min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--outline); background: transparent; color: inherit; font: inherit; font-size: 16px }
.field input:focus { outline: 2px solid var(--gold); outline-offset: 1px }
.pro-status:empty { display: none }
.small { font-size: 12px; margin: 0 }
.pro-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 16px }
.pro-links a { color: var(--muted); text-decoration: none; font-size: 14px; display: inline-flex; align-items: center }
.pro-done { font-size: 18px; text-align: center; margin: 16px 0 }
.pro-row { flex-wrap: wrap; gap: 8px; margin-top: 16px }
.section-heading { margin: 20px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted) }
.arc-card { border: 1px solid var(--outline); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px }
.arc-card h4 { margin: 0 0 6px; color: var(--gold) }
.arc-card p, .appears p { margin: 0; font-size: 15px }
.appears { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; margin-bottom: 8px }
.word small { display: block }
