/* Antaryatra — screens. Tokens and base components come from tokens.css (Organic design system). */
html { height: 100%; }
body { min-height: 100%; }
body { font-family: 'Figtree', 'Noto Sans Gujarati', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
body { padding-bottom: calc(var(--nav-h) + var(--mini-h) + env(safe-area-inset-bottom)); --nav-h: 62px; --mini-h: 0px; }
body.has-mini { --mini-h: 76px; }
body.no-nav { --nav-h: 0px; }
body.no-nav .nav { display: none; }
button { font: inherit; color: inherit; }
input { font: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.app { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--color-bg); padding-bottom: 8px; }
@media (min-width: 560px) { body { background: var(--color-neutral-100); } .app, .nav, .mini { max-width: 520px; margin-left: auto; margin-right: auto; } }

/* — text helpers — */
.h-display { font-family: var(--font-heading); font-weight: 400; line-height: 1.15; letter-spacing: -0.015em; }
.muted { color: var(--color-neutral-700); }
.small { font-size: 13px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pretty { text-wrap: pretty; }

/* — layout primitives — */
.row { display: flex; flex-direction: row; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 0 20px; }
.section { padding: 24px 20px 0 20px; }
.section-title { font-family: var(--font-heading); font-size: 19px; margin-bottom: 12px; }
.sub-title { font-family: var(--font-heading); font-size: 16px; color: var(--color-accent-2-800); margin: 14px 0 2px 0; }

/* — app bar — */
.appbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--color-bg); border-bottom: 1px solid var(--color-neutral-200); }
.appbar .title { font-family: var(--font-heading); font-size: 18px; line-height: 1.3; }
.appbar .sub { font-size: 12px; color: var(--color-neutral-700); }

/* — buttons — */
.ibtn { width: 44px; height: 44px; border-radius: 999px; border: none; background: var(--color-neutral-200); color: var(--color-text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0; }
.ibtn:hover { background: var(--color-accent-100); }
.ibtn.ghost { background: transparent; }
.ibtn.dark { background: rgba(255,255,255,0.12); color: var(--color-neutral-100); }
.ibtn.dark:hover { background: rgba(255,255,255,0.22); }
.pill { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--color-divider); background: transparent; color: var(--color-text); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.pill:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.pill.on { background: var(--color-accent-100); border-color: var(--color-accent-300); color: var(--color-accent-800); }
.pill.filled { background: var(--color-neutral-200); border-color: transparent; }
.pill.primary { background: var(--color-accent); border-color: transparent; color: var(--color-bg); font-weight: 700; }
.pill.primary:hover { background: var(--color-accent-600); }
.btn { min-height: 44px; }
.btn-block { margin-top: 0; }
.tag-dark { background: rgba(255,255,255,0.14); color: var(--color-neutral-100); }

/* — search — */
.search { display: flex; align-items: center; gap: 10px; padding: 0 6px 0 16px; height: 48px; border-radius: 999px; background: var(--color-neutral-200); }
.search.tall { height: 52px; }
.search input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; font-size: 15px; color: var(--color-text); }
.search input::placeholder { color: var(--color-neutral-600); }
.search .clear { width: 28px; height: 28px; border-radius: 999px; border: none; background: var(--color-neutral-300); color: var(--color-neutral-800); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.search .mic { width: 40px; height: 40px; border-radius: 999px; border: none; background: var(--color-accent-100); color: var(--color-accent-800); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.search .mic.on { background: var(--color-accent); color: var(--color-bg); }
.listening { text-align: center; font-size: 13px; color: var(--color-accent-700); margin-top: 8px; }

/* — lists — */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-height: 44px; cursor: pointer; border-bottom: 1px solid var(--color-neutral-200); text-align: left; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; }
.list-row:hover { background: color-mix(in srgb, var(--color-accent) 6%, transparent); }
.list-row .t { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.list-row .m { font-size: 12px; color: var(--color-neutral-700); margin-top: 2px; }
.list-row .num { width: 34px; height: 34px; border-radius: 999px; background: var(--color-accent-2-200); color: var(--color-accent-2-900); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.list-row .circ { width: 36px; height: 36px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.circ.video { background: var(--color-accent-200); color: var(--color-accent-800); }
.circ.audio { background: var(--color-accent-2-200); color: var(--color-accent-2-900); }
.circ.book { background: var(--color-neutral-200); color: var(--color-neutral-800); }
.circ.now { background: var(--color-accent); color: var(--color-bg); }
.thumb { width: 74px; height: 44px; border-radius: 10px; flex-shrink: 0; background: var(--color-neutral-300) center/cover no-repeat; }
.thumb.lg { width: 108px; height: 70px; border-radius: 0; }
.chev { color: var(--color-neutral-600); flex-shrink: 0; }

/* — cards — */
.card { border-radius: var(--radius-lg); }
.card.tile { padding: 14px; flex-direction: row; align-items: center; gap: 12px; cursor: pointer; text-align: left; border: none; width: 100%; }
.card.tile:hover { background: var(--color-accent-100); }
.card.tile .ic { width: 40px; height: 40px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.card.tile .t { font-weight: 700; font-size: 15px; }
.card.tile .m { font-size: 13px; color: var(--color-neutral-700); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero { border-radius: var(--radius-lg); overflow: hidden; height: 150px; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.resume { margin: 10px 20px 0; display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--color-accent-100); border-radius: var(--radius-lg); cursor: pointer; border: none; width: calc(100% - 40px); text-align: left; }
.resume:hover { background: var(--color-accent-200); }
.resume .play { width: 48px; height: 48px; border-radius: 999px; background: var(--color-accent); color: var(--color-bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bar { height: 6px; border-radius: 999px; background: var(--color-accent-200); overflow: hidden; }
.bar > div { height: 100%; border-radius: 999px; background: var(--color-accent); }

/* — bottom nav — */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--color-bg); border-top: 1px solid var(--color-neutral-200); padding: 8px 8px calc(6px + env(safe-area-inset-bottom)) 8px; }
.nav a { flex: 1; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--color-neutral-600); text-decoration: none; font-size: 11px; }
.nav a.on { color: var(--color-accent-700); font-weight: 700; }

/* — audio mini bar — */
.mini { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 19; padding: 0 12px 8px; background: linear-gradient(to bottom, transparent, var(--color-bg) 40%); }
.mini .box { display: flex; flex-direction: column; background: var(--color-accent-100); border-radius: 20px; box-shadow: var(--shadow-md); overflow: hidden; }
.mini .box.dark { background: var(--color-neutral-900); color: var(--color-neutral-100); border-radius: 18px; }
.mini .prog { height: 4px; background: var(--color-accent-200); } .mini .prog > div { height: 100%; background: var(--color-accent); }
.mini .box.dark .prog { background: rgba(255,255,255,0.18); }
.mini .inner { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; }
.mini .art { width: 44px; height: 44px; border-radius: 999px; overflow: hidden; flex-shrink: 0; background: var(--color-neutral-900); }
.mini .art img { width: 100%; height: 100%; object-fit: cover; }
.mini .vthumb { width: 96px; height: 54px; border-radius: 10px; overflow: hidden; flex-shrink: 0; background: #000; }
.mini .t { font-weight: 700; font-size: 14px; }
.mini .m { font-size: 12px; color: var(--color-accent-800); margin-top: 1px; }
.mini .box.dark .m { color: var(--color-neutral-400); }
.mini .ibtn { background: transparent; color: var(--color-accent-800); }
.mini .ibtn.play { background: var(--color-accent); color: var(--color-bg); }
.mini .box.dark .ibtn { color: var(--color-neutral-100); }

/* — audio player screen — */
.player { min-height: 100vh; display: flex; flex-direction: column; padding: calc(12px + env(safe-area-inset-top)) 20px 24px; }
.player .art { width: 240px; height: 240px; border-radius: 999px; overflow: hidden; box-shadow: var(--shadow-md); background: var(--color-neutral-900); margin: 0 auto; }
.player .art img { width: 100%; height: 100%; object-fit: cover; animation: spin 40s linear infinite; animation-play-state: paused; }
.player.playing .art img { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
.player .title { font-family: var(--font-heading); font-size: 24px; line-height: 1.2; text-align: center; margin-top: 28px; padding: 0 8px; }
.player .meta { font-size: 14px; color: var(--color-neutral-700); text-align: center; margin-top: 6px; }
.player .status { font-size: 11px; color: var(--color-neutral-600); text-align: center; margin-top: 8px; display: flex; justify-content: center; align-items: center; gap: 5px; }
.player .status i { width: 6px; height: 6px; border-radius: 999px; background: var(--color-neutral-400); display: inline-block; }
.player .status.live i { background: var(--color-accent-2); }
.player .status.err i { background: var(--color-accent-400); }
.scrub { position: relative; height: 32px; cursor: pointer; touch-action: none; }
.scrub .track { position: absolute; left: 0; right: 0; top: 12px; height: 8px; border-radius: 999px; background: var(--color-accent-200); overflow: hidden; }
.scrub .fill { height: 100%; border-radius: 999px; background: var(--color-accent); }
.scrub .thumb { position: absolute; top: 6px; width: 20px; height: 20px; margin-left: -10px; border-radius: 999px; background: var(--color-accent); border: 3px solid var(--color-bg); box-shadow: var(--shadow-sm); box-sizing: border-box; pointer-events: none; }
.scrub input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--color-neutral-700); font-variant-numeric: tabular-nums; }
.transport { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.transport .skip { width: 52px; height: 52px; }
.transport .play { width: 76px; height: 76px; background: var(--color-accent); color: var(--color-bg); box-shadow: var(--shadow-md); }
.transport .play:hover { background: var(--color-accent-600); }
.extras { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }

/* — sheets — */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent); display: flex; flex-direction: column; justify-content: flex-end; }
.sheet { background: var(--color-bg); color: var(--color-text); border-radius: 28px 28px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); max-height: 80vh; display: flex; flex-direction: column; max-width: 520px; width: 100%; margin: 0 auto; }
.sheet .grab { width: 40px; height: 4px; border-radius: 999px; background: var(--color-neutral-300); margin: 0 auto 14px; }
.sheet .h { font-family: var(--font-heading); font-size: 20px; margin-bottom: 4px; }
.sheet .body { overflow-y: auto; flex: 1; min-height: 0; }
.radio-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; cursor: pointer; border-bottom: 1px solid var(--color-neutral-200); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; font-size: 15px; }
.radio-row .dot { width: 18px; height: 18px; border-radius: 999px; border: 1.5px solid var(--color-neutral-400); flex-shrink: 0; }
.radio-row.on .dot { border-color: var(--color-accent); background: var(--color-accent); box-shadow: inset 0 0 0 4px var(--color-bg); }
.seg-row { display: flex; gap: 6px; }
.seg-row button { flex: 1; min-height: 40px; border-radius: 999px; border: 1px solid var(--color-divider); background: transparent; font-size: 13px; font-weight: 700; cursor: pointer; }
.seg-row button.on { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-bg); }
.switch { width: 40px; height: 24px; border-radius: 999px; background: var(--color-neutral-300); position: relative; flex-shrink: 0; border: none; padding: 0; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 999px; background: var(--color-bg); box-shadow: var(--shadow-sm); transition: left 0.15s; }
.switch.on { background: var(--color-accent); } .switch.on::after { left: 19px; }

/* — theater (video) — */
.theater { min-height: 100vh; background: var(--color-neutral-900); color: var(--color-neutral-100); display: flex; flex-direction: column; }
.theater .appbar { background: var(--color-neutral-900); border-bottom: none; color: var(--color-neutral-100); }
.theater .appbar .kicker { color: var(--color-accent-300); }
.theater .appbar .sub { color: var(--color-neutral-400); }
.video-slot { width: 100%; aspect-ratio: 16 / 9; background: #000; position: relative; }
.theater .vtitle { font-family: var(--font-heading); font-size: 20px; line-height: 1.35; }
.theater .vmeta { font-size: 13px; color: var(--color-neutral-400); margin-top: 5px; }
.theater .actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; overflow-x: auto; }
.theater .pill { color: var(--color-neutral-200); border-color: rgba(255,255,255,0.25); }
.theater .pill.primary { color: var(--color-bg); border-color: transparent; }
.upnext { flex: 1; margin-top: 18px; background: var(--color-bg); color: var(--color-text); border-radius: 24px 24px 0 0; padding: 18px 20px 14px; }
.upnext .h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.upnext .h .t { font-family: var(--font-heading); font-size: 17px; }
.upnext .row-v { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-height: 44px; cursor: pointer; border-bottom: 1px solid var(--color-neutral-200); border-left: 0; border-right: 0; border-top: 0; background: none; width: 100%; text-align: left; }
.upnext .row-v.now { background: var(--color-accent-100); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 12px; }
.upnext .row-v .t { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.upnext .row-v .m { font-size: 12px; color: var(--color-neutral-700); }

/* — the persistent YouTube surface — */
.video-host { position: fixed; z-index: 15; background: #000; overflow: hidden; }
.video-host.docked { position: fixed; z-index: 6; }   /* pinned over .video-slot by JS (place()) */
.video-host.mini { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 8px + env(safe-area-inset-bottom)); height: 70px; border-radius: 18px; box-shadow: var(--shadow-lg); z-index: 19; }
.video-host.fs { position: fixed; inset: 0; z-index: 60; border-radius: 0; }
.yt-crop { position: absolute; inset: 0; overflow: hidden; }
.yt-crop iframe, .yt-crop .yt-el { position: absolute; left: 0; width: 100%; top: -60px; height: calc(100% + 120px); border: 0; }
.video-host.mini .yt-crop { width: 124px; }
.video-host.mini .yt-crop iframe, .video-host.mini .yt-crop .yt-el { top: -14px; height: calc(100% + 28px); }
.shield { position: absolute; inset: 0; }
.mini-video-info { position: absolute; left: 134px; right: 0; top: 0; bottom: 0; display: flex; align-items: center; gap: 4px; padding-right: 6px; color: var(--color-neutral-100); }
.mini-video-info .grow { cursor: pointer; }
.mini-video-info .t { font-weight: 700; font-size: 13px; }
.mini-video-info .m { font-size: 12px; color: var(--color-neutral-400); margin-top: 1px; }
.mini-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.18); }
.mini-prog > div { height: 100%; background: var(--color-accent); }

.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0) 32%, rgba(0,0,0,0) 62%, rgba(0,0,0,0.65)); transition: opacity 0.25s; color: #fff; }
.overlay.hide { opacity: 0; pointer-events: none; }
.overlay .top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.overlay .top .t { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,0.6); padding-left: 4px; }
.overlay .cc { min-height: 32px; padding: 0 9px; font-size: 11px; font-weight: 700; border-radius: 8px; border: 1.5px solid rgba(255,255,255,0.7); background: transparent; color: #fff; cursor: pointer; }
.overlay .cc.on { background: #fff; color: #201e1d; }
.overlay .obtn { border-radius: 999px; border: none; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; background: transparent; }
.overlay .obtn:hover { background: rgba(255,255,255,0.18); }
.overlay .center { display: flex; align-items: center; justify-content: center; gap: 34px; }
.overlay .center .skip { width: 48px; height: 48px; background: rgba(0,0,0,0.35); }
.overlay .center .play { width: 64px; height: 64px; background: rgba(0,0,0,0.45); }
.overlay .bottom { padding: 0 12px 6px; display: flex; flex-direction: column; }
.overlay .bottom .r { display: flex; align-items: center; gap: 8px; }
.overlay .time { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.overlay .time span { color: rgba(255,255,255,0.6); }
.overlay .chip { min-height: 28px; padding: 3px 10px; border-radius: 12px; background: rgba(255,255,255,0.14); color: #fff; font-size: 11px; font-weight: 700; border: none; cursor: pointer; }
.vscrub { position: relative; height: 22px; margin-top: 2px; }
.vscrub .track { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.3); }
.vscrub .buf, .vscrub .fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 999px; }
.vscrub .buf { background: rgba(255,255,255,0.35); } .vscrub .fill { background: var(--color-accent); }
.vscrub .thumb { position: absolute; top: 4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 999px; background: var(--color-accent); border: 2px solid #fff; box-sizing: border-box; box-shadow: 0 0 0 3px rgba(198,113,57,0.3); pointer-events: none; }
.vscrub input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.ripple { position: absolute; top: 50%; width: 220px; height: 220px; margin-top: -110px; border-radius: 999px; background: rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center; pointer-events: none; color: #fff; font-size: 13px; font-weight: 700; }
.ripple.l { left: -60px; } .ripple.r { right: -60px; }
.ripple.l > div { margin-left: 50px; } .ripple.r > div { margin-right: 50px; }
.ripple > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ripple::before { content: ''; position: absolute; inset: 0; border-radius: 999px; background: rgba(255,255,255,0.25); animation: rip 0.6s ease-out forwards; }
@keyframes rip { from { transform: scale(0.6); opacity: 0.55; } to { transform: scale(1.4); opacity: 0; } }
.ended { position: absolute; inset: 0; background: rgba(15,13,11,0.82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #fff; }
.ended .ring { position: relative; width: 64px; height: 64px; }
.ended .ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ended .ring .n { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-heading); font-size: 26px; }
.ended .pill { color: #fff; border-color: rgba(255,255,255,0.35); }
.ended .pill.primary { color: var(--color-bg); border-color: transparent; }
.video-host.fs .overlay .center { gap: 48px; }
.video-host.fs .overlay .center .skip { width: 56px; height: 56px; }
.video-host.fs .overlay .center .play { width: 76px; height: 76px; }
.video-host.fs .overlay .top, .video-host.fs .overlay .bottom { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.video-host.fs .yt-crop iframe, .video-host.fs .yt-crop .yt-el { top: -80px; height: calc(100% + 160px); }

/* — read — */
.book-frame { width: 100%; height: calc(100vh - 120px); border: 0; background: var(--color-neutral-200); }
.note { font-size: 14px; line-height: 1.65; padding: 14px 16px; background: var(--color-accent-2-100); color: var(--color-accent-2-900); border-radius: var(--radius-lg); }

/* — toast — */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--mini-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--color-neutral-900); color: var(--color-neutral-100); padding: 10px 16px; border-radius: 999px; font-size: 13px; z-index: 50; box-shadow: var(--shadow-lg); max-width: 90vw; text-align: center; }
