/* ---------- motywy ---------- */
:root {
  --hl: #f5b700;
  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Literata', Georgia, serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
:root, [data-theme="light"] {
  --bg: #ffffff; --fg: #1d1d1f; --muted: #6e6e73; --surface: #f4f4f5; --surface-2: #e9e9ec;
  --line: rgba(0, 0, 0, .08); --shadow: 0 10px 40px rgba(0, 0, 0, .12); --glass: rgba(255, 255, 255, .82);
  color-scheme: light;
}
[data-theme="sepia"] {
  --bg: #f4ecd8; --fg: #433422; --muted: #85715a; --surface: #ebe1c8; --surface-2: #e0d4b7;
  --line: rgba(67, 52, 34, .12); --shadow: 0 10px 40px rgba(67, 52, 34, .18); --glass: rgba(244, 236, 216, .85);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1b1b1d; --fg: #ececec; --muted: #9a9aa0; --surface: #262629; --surface-2: #313135;
  --line: rgba(255, 255, 255, .08); --shadow: 0 10px 40px rgba(0, 0, 0, .5); --glass: rgba(27, 27, 29, .82);
  color-scheme: dark;
}
[data-theme="black"] {
  --bg: #000000; --fg: #d8d8d8; --muted: #8a8a8a; --surface: #121212; --surface-2: #1c1c1c;
  --line: rgba(255, 255, 255, .09); --shadow: 0 10px 40px rgba(0, 0, 0, .7); --glass: rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* ---------- baza ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  transition: background-color .3s, color .3s;
}
#app { min-height: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.pad { padding: 24px 0; }
.i { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--hl); outline-offset: 2px; border-radius: 8px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; position: relative;
  color: var(--fg); transition: background-color .15s, transform .1s;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.spin .i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 12px; font-weight: 550; transition: background-color .15s, opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--fg); color: var(--bg); }
.btn.primary:hover { opacity: .88; }
.btn.ghost { background: var(--surface); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: #e5484d; color: #fff; }
.btn.small { height: 34px; font-size: 13px; }
.btn.wide { width: 100%; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 500; transition: all .15s;
}
.chip.active { background: var(--fg); color: var(--bg); }

.loading { display: grid; place-items: center; height: 100vh; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--surface-2); border-top-color: var(--fg); animation: spin .8s linear infinite; }

.error-page { max-width: 420px; margin: 20vh auto; padding: 0 24px; text-align: center; display: grid; gap: 12px; justify-items: center; }

/* ---------- logowanie ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(360px, 100%); display: grid; gap: 14px; }
.login-card p { margin: 0 0 8px; }
.login-card label, .form label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.login-card input, .form input {
  height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--fg); font-size: 16px; outline: none; transition: border-color .15s, background-color .15s;
}
.login-card input:focus, .form input:focus { border-color: var(--fg); background: var(--bg); }
.login-card .btn { height: 46px; margin-top: 6px; }
.login-error { color: #e5484d; font-size: 14px; min-height: 1.4em; }
.form { display: grid; gap: 12px; }

.brand { display: flex; align-items: center; gap: 8px; font: 600 20px/1 var(--font-display); letter-spacing: -.02em; }
.brand.big { font-size: 30px; margin-bottom: 4px; }

/* ---------- biblioteka ---------- */
.library { max-width: 1240px; margin: 0 auto; padding: calc(var(--safe-t) + 8px) calc(20px + var(--safe-r)) 64px calc(20px + var(--safe-l)); }
.lib-head {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; background: var(--bg);
}
.lib-actions { display: flex; align-items: center; gap: 6px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--surface);
  color: var(--muted); width: 220px; transition: width .2s var(--ease);
}
.search input { border: 0; background: none; outline: none; width: 100%; color: var(--fg); }
.search:focus-within { width: 280px; }
@media (max-width: 640px) {
  .search { width: 40px; padding: 0 11px; }
  .search input { width: 0; }
  .search:focus-within { width: 160px; }
  .search:focus-within input { width: 100%; }
  .lib-actions .btn span { display: none; }
  .lib-actions .btn { width: 40px; padding: 0; }
}

.hero {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; margin: 12px 0 36px; padding: 20px;
  border-radius: 22px; background: var(--surface); transition: transform .2s var(--ease), background-color .2s;
}
.hero:hover { background: var(--surface-2); }
.hero:active { transform: scale(.99); }
.hero-cover { width: 110px; aspect-ratio: 2/3; }
.hero-info { min-width: 0; display: grid; gap: 4px; }
.hero h1 { font: 600 clamp(20px, 3vw, 28px)/1.2 var(--font-display); letter-spacing: -.02em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hero p { margin: 0; }
.hero .meta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hero .progress { margin: 10px 0 4px; max-width: 360px; }
.hero-play { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--fg); color: var(--bg); }
@media (max-width: 560px) {
  .hero { grid-template-columns: 80px 1fr; gap: 16px; padding: 16px; }
  .hero-cover { width: 80px; }
  .hero-play { display: none; }
}

.progress { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--fg); border-radius: 4px; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { font-size: 20px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 20px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 22px 14px; } }
.card { position: relative; min-width: 0; }
.card-link { display: grid; gap: 6px; }
.card h3 { font-size: 14px; line-height: 1.3; margin-top: 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card p { margin: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cover-wrap { position: relative; border-radius: 10px; transition: transform .25s var(--ease); }
.card:hover .cover-wrap { transform: translateY(-3px); }
.cover {
  width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; display: block; background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 8px 24px -8px rgba(0, 0, 0, .25);
}
.cover-fallback {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 14px;
  background: linear-gradient(160deg, hsl(var(--h) 45% 62%), hsl(calc(var(--h) + 40) 40% 38%)); color: #fff;
}
.cover-fallback span { font: 600 15px/1.2 var(--font-display); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.cover-fallback small { font-size: 11px; opacity: .85; }
.badge {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.cover-progress { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .35); overflow: hidden; backdrop-filter: blur(4px); }
.cover-progress > div { height: 100%; background: #fff; }
.card-menu { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; background: rgba(0, 0, 0, .45); color: #fff; opacity: 0; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.card-menu:hover { background: rgba(0, 0, 0, .65); }
.card:hover .card-menu, .card-menu:focus-visible { opacity: 1; }
@media (hover: none) { .card-menu { opacity: 1; } }

.empty { grid-column: 1/-1; display: grid; justify-items: center; text-align: center; gap: 10px; padding: 64px 16px; color: var(--muted); }
.empty h3 { color: var(--fg); }
.empty p { max-width: 460px; margin: 0; }
.empty .i { display: inline; vertical-align: -2px; }

.drop-overlay {
  position: fixed; inset: 12px; z-index: 50; border: 2px dashed var(--fg); border-radius: 24px; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--glass);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-weight: 600; pointer-events: none;
}
.library.dragging .drop-overlay { display: flex; }

/* ---------- czytnik ---------- */
.reader { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }
.r-stage { position: absolute; inset: 0; }
.chapter-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }

.r-top, .r-bottom {
  position: absolute; left: 0; right: 0; z-index: 5; background: var(--glass);
  backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px);
  transition: transform .35s var(--ease), opacity .3s;
}
.r-top {
  top: 0; display: flex; align-items: center; gap: 4px;
  padding: calc(var(--safe-t) + 6px) calc(8px + var(--safe-r)) 6px calc(8px + var(--safe-l));
  border-bottom: 1px solid var(--line);
}
.r-title { flex: 1; min-width: 0; display: grid; text-align: center; line-height: 1.25; padding: 0 4px; }
.r-title strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-chapter { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn.aa { font: 600 17px/1 var(--font-display); }

.r-bottom {
  bottom: 0; padding: 8px calc(16px + var(--safe-r)) calc(var(--safe-b) + 10px) calc(16px + var(--safe-l));
  border-top: 1px solid var(--line); display: grid; gap: 4px;
}
.reader.chrome-hidden .r-top { transform: translateY(-100%); opacity: 0; }
.reader.chrome-hidden .r-bottom { transform: translateY(100%); opacity: 0; }
/* przy ukrytym pasku odtwarzacz zostaje jako cienka linia postępu */
.reader.chrome-hidden .r-locate { bottom: calc(var(--safe-b) + 16px); }

.r-scrub { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.r-scrub .t-right { text-align: right; }
.no-audio .r-scrub { grid-template-columns: 64px 1fr 0; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; margin: 0;
  --p: 0%;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--surface-2); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--surface-2); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--fg); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--fg);
  box-shadow: 0 0 0 4px var(--bg); transition: transform .15s;
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--fg); box-shadow: 0 0 0 4px var(--bg); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.3); }

.r-controls { display: flex; align-items: center; justify-content: center; gap: clamp(2px, 2vw, 14px); }
.r-controls .icon-btn { width: 44px; height: 44px; }
.r-controls .icon-btn .skip-n { position: absolute; font-size: 8.5px; font-weight: 700; top: 50%; left: 50%; transform: translate(-50%, -42%); }
.play-btn {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--fg); color: var(--bg);
  transition: transform .15s var(--ease), box-shadow .3s; margin: 0 6px;
}
.play-btn:active { transform: scale(.93); }
.playing .play-btn { box-shadow: 0 0 0 6px color-mix(in srgb, var(--hl) 35%, transparent); }
.play-btn .i-play { transform: translateX(2px); }
.pill-btn {
  min-width: 52px; height: 32px; padding: 0 10px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-variant-numeric: tabular-nums;
}
.pill-btn.on { background: var(--fg); color: var(--bg); }
.timer-left:empty { display: none; }

.r-status { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--muted); }
.r-status span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-status .s-book { flex: none; }

.r-locate {
  position: absolute; z-index: 6; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom-h, 170px) + 12px);
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--fg); color: var(--bg); font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
  animation: pop .3s var(--ease);
}
.has-audio { --bottom-h: calc(150px + var(--safe-b)); }
.no-audio { --bottom-h: calc(70px + var(--safe-b)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- arkusze ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0); transition: background-color .25s;
}
.sheet-backdrop.open { background: rgba(0, 0, 0, .32); }
.sheet {
  position: absolute; background: var(--bg); color: var(--fg); box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .3s var(--ease); max-height: 100%;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 6px 20px; }
.sheet-head h2 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { overflow-y: auto; overflow-x: hidden; padding: 4px 20px calc(24px + var(--safe-b)); overscroll-behavior: contain; }

.sheet-bottom, .sheet-small {
  left: 50%; bottom: 0; width: min(520px, 100%); max-height: 88vh; border-radius: 22px 22px 0 0;
  transform: translate(-50%, 100%);
}
.open .sheet-bottom, .open .sheet-small { transform: translate(-50%, 0); }
.sheet-right, .sheet-left { top: 0; bottom: 0; width: min(400px, 100%); }
.sheet-right { right: 0; transform: translateX(100%); border-radius: 22px 0 0 22px; padding-right: var(--safe-r); }
.sheet-left { left: 0; transform: translateX(-100%); border-radius: 0 22px 22px 0; padding-left: var(--safe-l); }
.sheet-right .sheet-head, .sheet-left .sheet-head { padding-top: calc(14px + var(--safe-t)); }
.open .sheet-right, .open .sheet-left { transform: none; }
@media (max-width: 640px) {
  .sheet-right, .sheet-left {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 86vh; border-radius: 22px 22px 0 0; transform: translateY(100%);
  }
  .sheet-right .sheet-head, .sheet-left .sheet-head { padding-top: 14px; }
  .open .sheet-right, .open .sheet-left { transform: none; }
}
.sheet-small .sheet-head::before, .sheet-bottom .sheet-head::before { content: none; }
.confirm-text { margin: 4px 0 0; }

.menu { display: grid; gap: 2px; }
.menu button {
  display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 12px; border-radius: 12px; text-align: left; font-weight: 500;
}
.menu button:hover { background: var(--surface); }
.menu .danger { color: #e5484d; }

/* spis treści */
.toc { display: grid; gap: 1px; }
.toc button {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; text-align: left; padding: 11px 12px;
  padding-left: calc(12px + var(--d) * 16px); border-radius: 10px; font-size: 14.5px; line-height: 1.35;
}
.toc button:hover { background: var(--surface); }
.toc button.on { background: var(--surface-2); font-weight: 600; }
.toc small { color: var(--muted); flex: none; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ustawienia */
.settings { display: grid; gap: 26px; padding-top: 4px; }
.settings section { display: grid; gap: 12px; min-width: 0; }
.settings { min-width: 0; }
.settings h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.settings h3.sub, .sheet-body h3.sub { margin-top: 4px; }
.seg { display: flex; background: var(--surface); border-radius: 12px; padding: 3px; gap: 2px; }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 0 18%; }
.seg[data-key="theme"] button { font-size: 12px; padding: 0 2px; }
.seg button {
  flex: 1 1 0; min-width: 0; height: 36px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted); transition: all .15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px;
}
.seg button.on { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg button[style*="--sw"] { position: relative; }
.seg button[style*="--sw"]::before {
  content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .5); margin-right: 4px; vertical-align: 0;
}

.font-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.font-grid button {
  display: grid; justify-items: center; gap: 2px; padding: 10px 4px 8px; border-radius: 12px; background: var(--surface);
  border: 1.5px solid transparent; transition: border-color .15s;
}
.font-grid .aa { font-size: 22px; line-height: 1.1; }
.font-grid small { font-family: var(--font-ui); font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.font-grid button.on { border-color: var(--fg); }

.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-radius: 12px; padding: 3px; }
.stepper button { width: 64px; height: 38px; border-radius: 9px; font-family: var(--font-display); font-weight: 600; }
.stepper button:hover { background: var(--bg); }
.stepper output { font-variant-numeric: tabular-nums; font-weight: 600; }

.field-range { display: grid; gap: 4px; }
.field-range .lbl { display: flex; justify-content: space-between; font-size: 14px; }
.field-range output { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.settings[data-layout="paged"] .only-scroll, .settings[data-layout="scroll"] .only-paged { display: none; }

.switch { display: flex; align-items: center; gap: 12px; font-size: 14px; cursor: pointer; }
.switch input {
  -webkit-appearance: none; appearance: none; flex: none; width: 42px; height: 26px; border-radius: 999px; background: var(--surface-2);
  position: relative; transition: background-color .2s; cursor: pointer; margin: 0;
}
.switch input::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease);
}
.switch input:checked { background: var(--fg); }
.switch input:checked::after { transform: translateX(16px); background: var(--bg); }

.hl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.hl-opt {
  display: grid; gap: 6px; justify-items: center; padding: 12px 6px 8px; border-radius: 12px; background: var(--surface);
  border: 1.5px solid transparent;
}
.hl-opt.on { border-color: var(--fg); }
.hl-opt small { font-size: 11px; color: var(--muted); }
.hl-sample { font: 13px/1.5 var(--font-display); white-space: nowrap; }
.hl-sample i { font-style: normal; }
.hl-sample b { font-weight: 400; border-radius: .2em; }
.hl-background .hl-sample b { background: color-mix(in srgb, var(--hl) var(--hls, 38%), transparent); box-shadow: 0 0 0 .12em color-mix(in srgb, var(--hl) var(--hls, 38%), transparent); }
.hl-underline .hl-sample b { text-decoration: underline 2px var(--hl); text-underline-offset: .22em; }
.hl-text .hl-sample b { color: var(--hl); }
.hl-outline .hl-sample b { box-shadow: inset 0 0 0 1.5px var(--hl); padding: 0 .1em; }
.hl-focus .hl-sample i { opacity: .35; }
.hl-focus .hl-sample b { background: color-mix(in srgb, var(--hl) 12%, transparent); }

.colors { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.colors button, .color-custom {
  width: 32px; height: 32px; border-radius: 50%; background: var(--c); position: relative; transition: transform .15s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1);
}
.colors button.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c); }
.colors button:active { transform: scale(.9); }
.color-custom { background: conic-gradient(#f55, #fd5, #5f8, #5cf, #85f, #f5c, #f55); cursor: pointer; overflow: hidden; }
.color-custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.rate-big { text-align: center; font: 600 40px/1.2 var(--font-display); font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
input.wide { margin: 8px 0 16px; }
.sheet-small .seg + h3.sub { margin-top: 18px; margin-bottom: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---------- powiadomienia ---------- */
#toasts {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 64px);
  display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 12px 16px;
  border-radius: 14px; background: var(--fg); color: var(--bg); font-size: 14px; box-shadow: var(--shadow);
  animation: toast-in .3s var(--ease);
}
.toast.out { opacity: 0; transform: translateY(-6px); transition: all .25s; }
.toast-action { font-weight: 700; color: var(--hl); white-space: nowrap; padding: 4px 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* wąskie ekrany: odtwarzacz mieści się w 320–390 px */
.r-status .s-chapter { min-width: 0; }
@media (max-width: 420px) {
  .r-bottom { padding-left: calc(10px + var(--safe-l)); padding-right: calc(10px + var(--safe-r)); }
  .r-controls { gap: 0; justify-content: space-between; }
  .r-controls .icon-btn { width: 40px; height: 44px; }
  .play-btn { width: 54px; height: 54px; margin: 0 2px; }
  .pill-btn { min-width: 42px; padding: 0 8px; font-size: 12px; }
  .r-scrub { grid-template-columns: 52px 1fr 56px; gap: 6px; }
}

/* cienka linia postępu, widoczna tylko przy schowanych paskach */
.r-mini {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: calc(3px + var(--safe-b)); pointer-events: none;
  opacity: 0; transition: opacity .35s;
}
.r-mini > div { height: 3px; width: 0; background: color-mix(in srgb, var(--fg) 45%, transparent); transition: width .3s linear; }
.reader.chrome-hidden .r-mini { opacity: 1; }
.playing.chrome-hidden .r-mini > div { background: var(--hl); }
.hint { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
@media (max-width: 380px) { .r-top .icon-btn { width: 36px; } }
