/* Плеєр-читалка: текст іде за голосом. Підключається після style.css. */
body.listen { --read-size: 18px; }
body.listen.fs-1 { --read-size: 16px; }
body.listen.fs-3 { --read-size: 20px; }
body.listen.fs-4 { --read-size: 23px; }

.lhead { position: sticky; top: 0; z-index: 6; height: 56px; padding: 0 8px; display: flex; align-items: center; gap: 4px;
         background: rgba(12,17,32,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
         border-bottom: 1px solid #1B2238; padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
.lhead-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden;
               text-overflow: ellipsis; }
.lhead-title a { color: inherit; text-decoration: none; }
.icon-btn { flex: none; width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center;
            justify-content: center; color: var(--text); text-decoration: none; }
.icon-btn:hover { background: rgba(255,255,255,.05); color: var(--text); }
.icon-btn.aa { font: 600 16px var(--serif); }

.reader { max-width: 40rem; margin: 0 auto; padding: 24px 20px 260px; }
.reader .kicker { font-size: 12px; }
.reader h1 { margin: 6px 0 22px; font: 600 clamp(24px, 4vw, 32px)/1.15 var(--serif); color: var(--head); }
.reader p { margin: 0 -12px 14px; padding: 6px 12px; border-radius: 12px; font: var(--read-size)/1.65 var(--serif);
            color: var(--soft); transition: background .25s, color .25s; }
.reader p.past { color: var(--dim); }
.reader p.now { background: rgba(235,165,76,.11); color: #F7F1E6; }
.synced .reader p { cursor: pointer; }
.synced .reader p:hover:not(.now) { background: rgba(255,255,255,.025); }
.reader .note { font-size: 14px; color: var(--muted2); margin: -10px 0 22px; }
.reader .end { margin: 36px 0 0; padding: 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
               display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.reader .end span { color: var(--muted); font-size: 15px; }
.loading { color: var(--muted2); padding: 40px 0; text-align: center; }

.follow { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(232px + env(safe-area-inset-bottom)); z-index: 7;
          padding: 10px 18px; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: 14px;
          font-weight: 700; box-shadow: 0 6px 20px rgba(0,0,0,.4); }

/* панель плеєра */
.player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface);
          border-top: 1px solid var(--line); padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); }
.player-in { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.pchapter { font-size: 13px; color: var(--muted2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchapter.err { color: #F0A08A; }
.times { margin-top: 6px; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted2);
         font-variant-numeric: tabular-nums; }
.seek { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 20px; margin: 0; background: transparent; cursor: pointer; --p: 0%; }
.seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--p), #26304D var(--p)); }
.seek::-moz-range-track { height: 4px; border-radius: 2px; background: #26304D; }
.seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: var(--accent2); border: 0; }
.seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent2); border: 0; }
.ctrls { display: flex; align-items: center; justify-content: space-between; }
.c-btn { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; position: relative;
         color: var(--text); border-radius: 50%; font: 700 13px var(--sans); }
.c-btn:hover { background: rgba(255,255,255,.05); }
.c-btn.chap { width: 44px; height: 44px; color: var(--soft); }
.c-btn:disabled { opacity: .3; cursor: default; background: none; }
.c-btn .ring { position: absolute; inset: 7px; width: 34px; height: 34px; }
.c-btn.play { width: 64px; height: 64px; background: var(--accent); color: var(--on-accent);
              box-shadow: 0 0 24px rgba(235,165,76,.35); }
.c-btn.play:hover { background: var(--accent2); }
.c-btn.play.wait svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.opts { display: flex; gap: 8px; }
.opt { flex: 1; min-height: 44px; border-radius: 10px; border: 1px solid var(--line2); color: var(--text);
       font: 600 14px var(--sans); white-space: nowrap; }
.opt:hover { border-color: var(--line3); }
.opt.on { border-color: rgba(235,165,76,.55); background: rgba(235,165,76,.08); color: var(--accent-soft); }

/* список розділів */
.shade { position: fixed; inset: 0; z-index: 9; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 10; width: min(380px, 90vw); background: var(--bg);
          border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .25s;
          display: flex; flex-direction: column; }
.toc-open .shade { opacity: 1; pointer-events: auto; }
.toc-open .drawer { transform: none; }
.drawer-head { padding: calc(16px + env(safe-area-inset-top)) 16px 12px; border-bottom: 1px solid var(--line);
               display: flex; align-items: flex-start; gap: 8px; }
.drawer-head div { flex: 1; min-width: 0; }
.drawer-head b { display: block; font: 600 18px var(--serif); }
.drawer-head small { color: var(--muted2); font-size: 13px; }
.drawer ol { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.drawer li button { width: 100%; text-align: left; display: flex; gap: 12px; align-items: center; min-height: 48px;
                    padding: 6px 10px; border-radius: 10px; }
.drawer li button:hover { background: var(--surface); }
.drawer .n { width: 26px; height: 26px; flex: none; display: flex; align-items: center; justify-content: center;
             color: var(--muted2); font-size: 13px; font-variant-numeric: tabular-nums; }
.drawer .t { flex: 1; min-width: 0; font-size: 15px; }
.drawer .d { color: var(--muted2); font-size: 13px; font-variant-numeric: tabular-nums; }
.drawer li.cur button { background: var(--surface); }
.drawer li.cur .n { border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 800; }
.drawer li.cur .t { font-weight: 700; color: var(--head); }

/* нічний режим */
.night { position: fixed; inset: 0; z-index: 20; overflow-y: auto; color: var(--text);
         background-color: #070A14;
         background-image: radial-gradient(1.4px 1.4px at 12% 14%, rgba(238,231,218,.6) 50%, transparent 52%),
           radial-gradient(1px 1px at 78% 9%, rgba(238,231,218,.45) 50%, transparent 52%),
           radial-gradient(1.6px 1.6px at 90% 31%, rgba(246,194,122,.6) 50%, transparent 52%),
           radial-gradient(1px 1px at 24% 40%, rgba(238,231,218,.35) 50%, transparent 52%),
           radial-gradient(1.2px 1.2px at 58% 22%, rgba(238,231,218,.4) 50%, transparent 52%),
           radial-gradient(1px 1px at 36% 88%, rgba(238,231,218,.3) 50%, transparent 52%),
           radial-gradient(1.2px 1.2px at 70% 70%, rgba(238,231,218,.3) 50%, transparent 52%); }
.night-in { max-width: 440px; min-height: 100%; margin: 0 auto; display: flex; flex-direction: column;
            padding: calc(12px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom)); }
.night-top { display: flex; align-items: center; justify-content: space-between; }
.night-close { min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 10px;
               border: 1px solid #1E2640; color: var(--soft); font-size: 14px; }
.night-label { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.night-art { margin-top: 28px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.night-art .cover { width: 156px; box-shadow: 0 0 0 1px rgba(238,231,218,.06), 0 30px 60px -18px rgba(235,165,76,.28); }
.night-art .by { margin: 22px 0 0; font-size: 13px; color: var(--muted2); }
.night-art .kicker { margin-top: 14px; font-size: 12px; }
.night-art h2 { margin: 6px 0 0; font: 600 28px/1.15 var(--serif); }
.night .seekbox { margin-top: 30px; }
.night .seek::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--accent) var(--p), #1E2640 var(--p)); }
.night .seek::-moz-range-track { background: #1E2640; }
.night .ctrls { margin-top: 18px; }
.night .c-btn { width: 56px; height: 56px; font-size: 14px; }
.night .c-btn .ring { inset: 8px; width: 40px; height: 40px; }
.night .c-btn.chap { width: 48px; height: 48px; color: var(--muted); }
.night .c-btn.play { width: 80px; height: 80px; box-shadow: 0 0 36px rgba(235,165,76,.4); }
.night .opts { margin-top: 22px; gap: 10px; }
.night .opt { min-height: 48px; border-radius: 12px; border-color: #1E2640; }
.night .opt.on { border-color: rgba(235,165,76,.55); }
.night-hint { margin: auto 0 0; padding-top: 28px; display: flex; align-items: center; justify-content: center; gap: 8px;
              font-size: 13px; color: var(--dim); text-align: center; }
.night-open { overflow: hidden; }

@media (min-width: 900px) {
  .reader { padding-top: 40px; }
  .lhead { padding: 0 16px; }
}
