/* MangaNew — читалка розділу (chapters.tpl + reader.js). Читальна зона завжди темна (або обране тло), панель — темна. */

/* На сторінці читання — без шапки сайту й нижньої панелі: їх замінює панель читалки */
.is-reading .header, .is-reading .tabbar { display: none; }
.is-reading body { padding-bottom: 0; }
.is-reading .main { padding-top: 0; }

:root {
  /* оформлення читалки (панель, діалоги, підказки) — завжди темне, незалежно від теми сайту */
  --rdc-fg: #e3e5ea; --rdc-muted: #9aa3b2; --rdc-surface: #161920; --rdc-surface-2: #1f232c; --rdc-surface-3: #2a2f3a;
}
.rd {
  --rd-bg: #121418; --rd-fg: #e3e5ea; --rd-muted: #9aa3b2; --rd-ph: #1b1e25; --rd-line: rgba(255, 255, 255, .08);
  --rd-w: 860px;
  position: relative; margin: 0 calc(50% - 50vw); background: var(--rd-bg); color: var(--rd-fg);
}
.rd[data-bg="black"] { --rd-bg: #000; --rd-ph: #0d0d0f; }
.rd[data-bg="light"] { --rd-bg: #eceae4; --rd-fg: #1b1d22; --rd-muted: #5b6270; --rd-ph: #dddad2; --rd-line: rgba(0, 0, 0, .08); }
.rd[data-width="narrow"] { --rd-w: 640px; }
.rd[data-width="full"] { --rd-w: 100%; }
.rd-ico { width: 20px; height: 20px; flex: none; }
.rd-ico--sm { width: 14px; height: 14px; }

/* ── Панель ── */
.rd-bar {
  position: sticky; top: 0; z-index: 50; color: var(--rdc-fg);
  background: rgba(12, 14, 18, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .32s cubic-bezier(.22, .8, .24, 1);
}
.rd-bar.is-hidden { transform: translateY(-100%); }
.rd-bar__in { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; height: 56px; max-width: 1320px; margin: 0 auto; padding: 0 16px; }
.rd-back { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--rdc-fg); }
.rd-back:hover { color: #fff; }
.rd-back__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.rd-back__title { font-family: var(--font-head); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-back__ch { font-size: 12px; color: var(--rdc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-nav { display: flex; align-items: center; gap: 6px; }
.rd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; min-width: 38px; padding: 0 10px; border: 0; border-radius: var(--radius-btn); background: rgba(255, 255, 255, .07); color: var(--rdc-fg); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: background-color .2s ease, color .2s ease; }
.rd-btn:hover { background: var(--accent); color: var(--accent-ink); }
.rd-btn.is-off { opacity: .3; pointer-events: none; }
.rd-btn--list { min-width: 130px; font-family: var(--font-head); }
.rd-btn--icon { background: transparent; }
.rd-btn__n { font-size: 12px; font-weight: 600; color: var(--rdc-muted); }
.rd-btn:hover .rd-btn__n { color: inherit; }
.rd-tools { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.rd-tools .rd-page { margin-right: 6px; font-size: 13px; font-weight: 700; color: var(--rdc-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rd-progress { height: 2px; background: rgba(255, 255, 255, .06); }
.rd-progress span { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .15s linear; }

/* ── Сторінки ── */
.rd-pages { display: flex; flex-direction: column; align-items: center; min-height: 60vh; padding: 0 0 8px; }
.rd[data-gap="1"] .rd-pages { gap: 10px; padding-top: 10px; }
.rp { position: relative; margin: 0; width: min(100%, var(--rd-w)); background: var(--rd-ph); }
.rp img { display: block; width: 100%; height: auto; }
.rp:has(img[src]) { background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .05) 50%, transparent 70%); background-size: 220% 100%; background-repeat: no-repeat; animation: rp-shine 1.4s ease-in-out infinite; }
@keyframes rp-shine { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@media (prefers-reduced-motion: reduce) { .rp:has(img[src]) { animation: none; } }
.rp.is-failed { min-height: 240px; }
.rp__retry { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); max-width: calc(100% - 32px); padding: 12px 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; }

/* Режим «По сторінці»: одна сторінка на екран, вписана по висоті */
.rd--paged .rp { display: none; animation: none; background: none; }
.rd--paged .rp.is-current { display: flex; align-items: center; justify-content: center; width: 100%; height: calc(100vh - 58px); height: calc(100dvh - 58px); cursor: pointer; }
.rd--paged .rp.is-current img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.rd--paged .rd-pages { min-height: 0; padding: 0; }
.rd--paged.rd--at-end .rd-pages { display: none; }

/* ── Кінець розділу ── */
.rd-end { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 760px; margin: 0 auto; padding: 40px 16px 48px; text-align: center; }
.rd-end__done { margin: 0; color: var(--rd-muted); }
.rd-end__done b { color: var(--rd-fg); }
.rd-end__done span { color: var(--ok); }
.rd-next { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 16px; width: min(100%, 460px); padding: 16px 22px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); text-align: left; box-shadow: 0 14px 30px -16px var(--accent); transition: transform .3s cubic-bezier(.22, .8, .24, 1), filter .2s ease; }
.rd-next:hover { color: var(--accent-ink); transform: translateY(-2px); filter: brightness(1.08); }
.rd-next__label { font-size: 13px; font-weight: 600; opacity: .85; }
.rd-next__ch { grid-column: 1; font-family: var(--font-head); font-size: 22px; }
.rd-next .rd-ico { grid-column: 2; grid-row: 1 / span 2; width: 28px; height: 28px; transition: transform .3s cubic-bezier(.22, .8, .24, 1); }
.rd-next:hover .rd-ico { transform: translateX(4px); }
.rd-next--last { background: var(--rd-ph); color: var(--rd-fg); box-shadow: none; text-align: center; grid-template-columns: 1fr; }
.rd-next--last .rd-next__ch { font-size: 15px; font-family: var(--font); font-weight: 600; color: var(--rd-muted); }
.rd-end__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; font-size: 14px; font-weight: 600; }
.rd-end__links a, .rd-link { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.rd-end__team { margin: 0; font-size: 13px; color: var(--rd-muted); }
.rd-end__team a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.rd-end__thanks:empty, .rd-end__rate:empty { display: none; }
.rd-end__thanks, .rd-end__rate { width: 100%; text-align: left; }
.rd-end__rate .mgr { padding: 16px; border-radius: 12px; background: rgba(255, 255, 255, .03); }

/* ── Коментарі (звичайне тло сайту) ── */
.rd-comments { max-width: 860px; margin: 0 auto; padding: 36px 16px 20px; background: var(--bg); color: var(--text); }
.rd-comments .sec-title { margin-bottom: 18px; }

/* ── Діалоги ── */
.rd-dialog { width: min(560px, calc(100vw - 24px)); max-height: min(82vh, 760px); padding: 0; border: 0; border-radius: 14px; background: var(--rdc-surface); color: var(--rdc-fg); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7); }
.rd-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.rd-dialog[open] { animation: rd-pop .3s cubic-bezier(.22, .8, .24, 1) both; }
@keyframes rd-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.rd-dialog__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--rdc-surface); border-bottom: 1px solid rgba(255, 255, 255, .07); }
.rd-dialog__head h2 { margin: 0 auto 0 0; font-family: var(--font-head); font-size: 17px; }
.rd-dialog__find { width: 120px; height: 36px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px; background: var(--rdc-surface-2); color: var(--rdc-fg); font: inherit; font-size: 14px; }
.rd-dialog__close { width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--rdc-surface-2); color: var(--rdc-fg); font-size: 20px; cursor: pointer; }
.rd-chlist { list-style: none; margin: 0; padding: 6px; }
.rd-chlist__a { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--rdc-fg); }
.rd-chlist__a:hover { background: var(--rdc-surface-2); color: var(--rdc-fg); }
.rd-chlist__a b { font-family: var(--font-head); font-size: 15px; white-space: nowrap; }
.rd-chlist__a span { min-width: 0; font-size: 13px; color: var(--rdc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-chlist__a.is-read b { color: #8b93a1; font-weight: 600; }
.rd-chlist__a.is-read b::after { content: " ✓"; color: var(--ok); }
.rd-chlist__a.is-current { background: var(--accent); }
.rd-chlist__a.is-current b, .rd-chlist__a.is-current span { color: var(--accent-ink); }
.rd-chlist__empty { padding: 20px; text-align: center; color: var(--rdc-muted); }

.rd-set { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.rd-opt { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rd-opt[hidden] { display: none; }
.rd-opt legend { width: 100%; margin-bottom: 8px; padding: 0; font-size: 13px; font-weight: 700; color: var(--rdc-muted); }
.rd-opt label { cursor: pointer; }
.rd-opt input { position: absolute; opacity: 0; pointer-events: none; }
.rd-opt span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 8px; background: var(--rdc-surface-2); font-size: 14px; font-weight: 600; transition: background-color .2s ease, color .2s ease; }
.rd-opt label:hover span { background: var(--rdc-surface-3); }
.rd-opt input:checked + span { background: var(--accent); color: var(--accent-ink); }
.rd-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.rd-check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.rd-check[hidden] { display: none; }
.rd-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.rd-keys { margin: 0; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 12px; line-height: 1.6; color: var(--rdc-muted); }

/* ── Тост ── */
.rd-toast { position: fixed; left: 50%; bottom: 20px; z-index: 60; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 24px); padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--rdc-surface); color: var(--rdc-fg); font-size: 14px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .7); transform: translateX(-50%); animation: rd-toast .35s cubic-bezier(.22, .8, .24, 1) both; }
@keyframes rd-toast { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translateX(-50%); } }
.rd-toast[hidden] { display: none; }
.rd-toast__btn { height: 34px; padding: 0 12px; border: 0; border-radius: var(--radius-btn); background: var(--rdc-surface-2); color: var(--rdc-fg); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.rd-toast__btn--main { background: var(--accent); color: var(--accent-ink); }

/* ── Телефон ── */
@media (max-width: 760px) {
  .rd-bar__in { grid-template-columns: minmax(0, 1fr) auto; height: auto; padding: 8px 10px; row-gap: 8px; }
  .rd-back { grid-column: 1; }
  .rd-tools { grid-column: 2; grid-row: 1; }
  .rd-nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  .rd-btn--list { flex: 1; }
  .rd-btn { height: 40px; min-width: 44px; }
  .rd-tools .rd-page { margin-right: 2px; }
  .rd-tools .rd-btn--icon[href] { display: none; }
  .rd--paged .rp.is-current { height: calc(100dvh - 104px); }
}
.rp.is-loaded { animation: none; background: none; }

/* ═══ Окрема сторінка читання: лише читалка, без шапки, футера й нижньої панелі сайту ═══ */
.rd-page .header, .rd-page .footer, .rd-page .tabbar { display: none !important; }
.rd-page body { padding-bottom: 0; background: #121418; }
.rd-page .main { padding: 0; }
.rd-page .main > .wrap { max-width: none; padding: 0; }
.rd-page .rd { margin: 0; min-height: 100vh; }

/* Кнопки лише для одного режиму */
.rd--paged .rd-only-scroll { display: none; }
.rd:not(.rd--paged) .rd-only-paged { display: none; }

/* Автопрокрутка: значок «пауза», коли увімкнена */
.rd-ico--pause { display: none; }
.rd--auto .rd-ico--play { display: none; }
.rd--auto .rd-ico--pause { display: block; }
.rd--auto [data-rd-auto] { background: var(--accent); color: var(--accent-ink); }
.rd-fs-btn[aria-pressed="true"] { color: var(--accent); }

/* ═══ Нижня панель: повзунок сторінок ═══ */
.rd-foot {
  position: fixed; left: 50%; bottom: 14px; z-index: 50; display: flex; align-items: center; gap: 10px;
  width: min(560px, calc(100vw - 24px)); padding: 8px 12px; border-radius: 14px;
  background: rgba(12, 14, 18, .94); color: var(--rdc-fg); box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .8);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transform: translateX(-50%); transition: transform .32s cubic-bezier(.22, .8, .24, 1), opacity .25s ease;
}
.rd-foot.is-hidden { transform: translate(-50%, calc(100% + 24px)); opacity: 0; pointer-events: none; }
.rd-foot__n { min-width: 34px; font-size: 13px; font-weight: 700; color: var(--rdc-muted); text-align: center; font-variant-numeric: tabular-nums; }
.rd-slider { flex: 1; min-width: 0; height: 28px; margin: 0; background: transparent; accent-color: var(--accent); cursor: pointer; }
.rd--rtl.rd--paged .rd-slider { direction: rtl; }
.rd-foot .rd-btn { height: 34px; min-width: 34px; padding: 0 8px; }
.rd--comments .rd-foot, .rd-toast:not([hidden]) ~ .rd-foot { opacity: 0; pointer-events: none; }

/* ═══ По сторінці: розворот і вписування ═══ */
.rd--paged .rd-pages { flex-direction: row; justify-content: center; align-items: center; }
.rd--paged.rd--rtl .rd-pages { flex-direction: row-reverse; }
.rd--spread .rp.is-current { width: 50%; justify-content: flex-end; }
.rd--spread.rd--rtl .rp.is-current { justify-content: flex-start; }
.rd--spread .rp.is-current + .rp.is-current { justify-content: flex-start; }
.rd--spread.rd--rtl .rp.is-current + .rp.is-current { justify-content: flex-end; }
.rd--paged[data-fit="width"] .rp.is-current { height: auto; min-height: calc(100vh - 58px); align-items: flex-start; }
.rd--paged[data-fit="width"] .rp.is-current img { width: 100%; max-width: 1100px; max-height: none; }
.rd--paged[data-fit="original"] .rp.is-current { height: auto; min-height: calc(100vh - 58px); overflow-x: auto; align-items: flex-start; }
.rd--paged[data-fit="original"] .rp.is-current img { max-width: none; max-height: none; width: auto; }

/* ═══ Коментарі — бічна панель ═══ */
.rd-comments {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(520px, 100vw); max-width: none; margin: 0;
  padding: 0 18px 24px; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); color: var(--text);
  box-shadow: -20px 0 50px -20px rgba(0, 0, 0, .8);
  transform: translateX(100%); visibility: hidden; transition: transform .35s cubic-bezier(.22, .8, .24, 1), visibility 0s linear .35s;
}
.rd--comments .rd-comments { transform: none; visibility: visible; transition: transform .35s cubic-bezier(.22, .8, .24, 1); }
.rd-comments__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 -18px 16px; padding: 14px 18px; background: var(--bg); border-bottom: 1px solid var(--line); }
.rd-comments__head .sec-title { margin: 0; }
.rd-comments__head h2:focus { outline: 0; }
.rd-shade { position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, .5); animation: rd-fade .3s ease both; }
.rd-shade[hidden] { display: none; }
@keyframes rd-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rd-comments, .rd--comments .rd-comments { transition: none; } }
/* Режим прокрутки: коментарі ще й під кінцем розділу (у потоці сторінки); кнопка на початку розділу відкриває їх бічною панеллю */
.rd:not(.rd--paged):not(.rd--comments) .rd-comments {
  position: static; z-index: auto; width: auto; max-width: none; margin: 0; padding: 0 max(16px, calc((100% - 860px) / 2)) 120px;
  overflow: visible; box-shadow: none; transform: none; visibility: visible; transition: none; border-top: 1px solid var(--line);
}
.rd:not(.rd--paged):not(.rd--comments) .rd-comments__head { position: static; margin: 0 0 16px; padding: 22px 0 0; border-bottom: 0; background: none; }
.rd:not(.rd--paged):not(.rd--comments) .rd-comments__head .rd-dialog__close { display: none; }

@media (max-width: 760px) {
  .rd-foot { bottom: 10px; padding: 6px 10px; }
  .rd-tools .rd-btn--icon[data-rd-comments-open] { display: inline-flex; }
  .rd-tools .rd-fs-btn { display: none; }
  .rd-tools .rd-btn__n { display: none; }
  /* кнопки розділів перенесено (reader.js) у нижню панель: верхній рядок — розділи, нижній — повзунок сторінок */
  .rd--nav-foot .rd-foot { flex-wrap: wrap; row-gap: 6px; padding: 8px 10px; }
  .rd--nav-foot .rd-foot > .rd-nav { flex: 1 0 100%; justify-content: space-between; }
  .rd--nav-foot .rd-foot .rd-nav .rd-btn { height: 42px; min-width: 48px; }
  .rd--nav-foot .rd-end { padding-bottom: 130px; }
  /* у режимі прокрутки під кінцем розділу йдуть коментарі (місце під нижню панель — уже в них) */
  .rd--nav-foot:not(.rd--paged) .rd-end { padding-bottom: 12px; }
}

/* ═══ Усі сторінки: сітка мініатюр ═══ */
.rd-dialog__sub { margin-left: 8px; font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--rdc-muted); }
.rd-dialog__foot { position: sticky; bottom: 0; padding: 12px 16px; background: var(--rdc-surface); border-top: 1px solid rgba(255, 255, 255, .07); font-size: 13px; }
.rd-dialog__foot a { color: var(--rdc-muted); text-decoration: underline; text-underline-offset: 2px; }
.rd-dialog__foot a:hover { color: var(--accent); }
.rd-dialog__foot:empty { display: none; }
.rd-keys--top { padding-top: 0; border-top: 0; }

/* ═══ Збільшення сторінки (режим «По сторінці») ═══ */
.rd--paged .rp.is-current { overflow: hidden; touch-action: pan-y; }
.rd--paged .rp.is-current img { transform-origin: 0 0; transition: transform .25s cubic-bezier(.22, .8, .24, 1); will-change: transform; }
.rd--zoomed .rp.is-current { cursor: grab; touch-action: none; }
.rd--zoomed .rp.is-current:active { cursor: grabbing; }
.rd--zoomed .rp.is-current img { transition: none; }

/* Перекладач: у списку розділів (свій — звичайно, інший — приглушено), у блоці кінця розділу */
.rd-chlist__a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; }
.rd-chlist__team { max-width: 140px; color: #7f8899; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-chlist__team:empty { display: none; }
.rd-chlist__a.is-other b, .rd-chlist__a.is-other .rd-chlist__name { opacity: .55; }
.rd-chlist__a.is-other .rd-chlist__team { color: #6c7486; font-style: italic; }
.rd-chlist__a.is-current .rd-chlist__team { color: var(--accent-ink); opacity: .85; }
.rd-next__team:empty { display: none; }
.rd-next__team { grid-column: 1; font-size: 13px; font-weight: 600; color: inherit; opacity: .85; }
.rd-next__team::before { content: "Переклад: "; }
@media (max-width: 760px) { .rd-chlist__team { max-width: 96px; } }

/* Кнопка «прочитано»: у шапці — іконка (зелена, коли прочитано), у кінці розділу — кнопка з підписом */
.rd-readbtn.is-on { color: var(--ok); }
.rd-readtoggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--rd-line, rgba(255, 255, 255, .14)); border-radius: 10px; background: transparent; color: var(--rd-fg, var(--rdc-fg)); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: border-color .15s ease, color .15s ease, background-color .15s ease; }
.rd-readtoggle .rd-ico { width: 20px; height: 20px; }
.rd-readtoggle:hover { border-color: var(--ok); color: var(--ok); }
.rd-readtoggle.is-on { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.rd-readtoggle[hidden], .rd-readbtn[hidden] { display: none; }

/* сторінка без відомих розмірів — до завантаження займає типову пропорцію 5:7, а не нуль (менше стрибків і хибного прогресу) */
.rd:not(.rd--paged) .rp:not([style*="aspect-ratio"]):not(.is-loaded):not(.is-failed) { aspect-ratio: 5 / 7; }


/* Скарга на переклад (chapters.tpl → data-rd-report) */
.rd-rep__lead { margin: 0; color: var(--rdc-muted); font-size: 13px; line-height: 1.5; }
.rd-rep__reasons { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; border: 0; }
.rd-rep__reasons .rd-check { align-items: flex-start; line-height: 1.4; }
.rd-rep__reasons .rd-check input { flex: none; margin-top: 1px; }
.rd-rep__f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--rdc-muted); }
.rd-rep__f input, .rd-rep__f textarea { width: 100%; padding: 9px 11px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px; background: var(--rdc-surface-2); color: var(--rdc-fg); font: inherit; font-size: 14px; font-weight: 400; resize: vertical; }
.rd-rep__f--page input { width: 110px; }
.rd-rep__f input:focus, .rd-rep__f textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.rd-rep__msg { margin: 0; padding: 9px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger-ink); font-size: 13px; }
.rd-rep__msg.is-ok { background: var(--ok-soft); color: var(--ok); }
.rd-rep__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rd-rep__foot a { color: var(--rdc-muted); font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }

/* ═══ Налаштування читання: групи, картки режиму, сегменти, кружечки тла, тумблери, клавіші ═══ */
.rd-dialog--set { width: min(520px, calc(100vw - 24px)); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.rd-dialog--set .rd-set { gap: 0; padding: 0 16px 8px; }
.rd-set__grp { display: flex; flex-direction: column; gap: 14px; padding: 16px 0; }
.rd-set__grp + .rd-set__grp { border-top: 1px solid rgba(255, 255, 255, .07); }
.rd-set__h { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--rdc-muted); }
.rd-dialog--set .rd-opt legend { margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--rdc-fg); }
.rd-dialog--set .rd-opt legend small { margin-left: 6px; font-weight: 500; color: var(--rdc-muted); }

/* сегменти: одна плашка, рівні частини (кнопки — у .rd-seg, щоб підпис legend не налазив на фон) */
.rd-seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 3px; padding: 3px; border-radius: 10px; background: var(--rdc-surface-2); }
.rd-seg label { display: flex; }
.rd-dialog--set .rd-seg span { flex: 1; justify-content: center; min-height: 34px; padding: 0 10px; border-radius: 8px; background: transparent; color: var(--rdc-muted); font-size: 13px; text-align: center; }
.rd-dialog--set .rd-seg label:hover span { background: var(--rdc-surface-3); color: var(--rdc-fg); }
.rd-dialog--set .rd-seg input:checked + span { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.rd-dialog--set .rd-opt:not(.rd-opt--cards):not(.rd-opt--swatch) { display: block; }
.rd-dialog--set .rd-opt[hidden], .rd-dialog--set .rd-set__hint[hidden] { display: none !important; }   /* приховані налаштування іншого режиму */

/* картки режиму */
.rd-opt--cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rd-opt--cards label { display: flex; }
.rd-dialog--set .rd-opt--cards span { flex: 1; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 10px; row-gap: 2px; min-height: 0; padding: 12px; border-radius: 12px; background: var(--rdc-surface-2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.rd-opt--cards svg { grid-row: 1 / 3; width: 26px; height: 26px; color: var(--rdc-muted); }
.rd-opt--cards b { font-size: 14px; }
.rd-opt--cards small { font-size: 12px; font-weight: 500; color: var(--rdc-muted); }
.rd-dialog--set .rd-opt--cards input:checked + span { background: var(--rdc-surface-2); color: var(--rdc-fg); box-shadow: inset 0 0 0 2px var(--accent); }
.rd-opt--cards input:checked + span svg { color: var(--accent); }

/* кружечки тла */
.rd-opt--swatch { display: flex; flex-wrap: wrap; gap: 8px; }
.rd-dialog--set .rd-opt--swatch span { gap: 8px; min-height: 38px; padding: 0 14px 0 8px; border-radius: 999px; background: var(--rdc-surface-2); font-size: 13px; }
.rd-dialog--set .rd-opt--swatch input:checked + span { background: var(--rdc-surface-2); color: var(--rdc-fg); box-shadow: inset 0 0 0 2px var(--accent); }
.rd-sw { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.rd-sw--dark { background: #161920; }
.rd-sw--black { background: #000; }
.rd-sw--light { background: #f4f1ea; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }

.rd-set__hint { margin: -4px 0 0; font-size: 12px; line-height: 1.5; color: var(--rdc-muted); }
.rd-set__hint[hidden] { display: none; }

/* тумблери */
.rd-switch { justify-content: space-between; gap: 14px; padding: 4px 0; }
.rd-switch > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rd-switch b { font-size: 14px; font-weight: 600; }
.rd-switch small { font-size: 12px; color: var(--rdc-muted); }
.rd-dialog--set .rd-switch input { flex: none; appearance: none; -webkit-appearance: none; position: relative; display: inline-block; border: 0; width: 42px; height: 24px; margin: 0; border-radius: 999px; background: var(--rdc-surface-3); cursor: pointer; transition: background-color .2s ease; }
.rd-dialog--set .rd-switch input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); clip-path: none; transform: none; transition: transform .2s ease; }
.rd-dialog--set .rd-switch input:checked { background: var(--accent); }
.rd-dialog--set .rd-switch input:checked::before { transform: translateX(18px); }
.rd-dialog--set .rd-switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* гарячі клавіші — згорнуто */
.rd-dialog--set .rd-keys { margin: 0; padding: 12px 0 8px; border-top: 1px solid rgba(255, 255, 255, .07); }
.rd-keys summary { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--rdc-muted); }
.rd-keys summary::-webkit-details-marker { display: none; }
.rd-keys summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s ease; }
.rd-keys[open] summary::after { transform: rotate(-135deg); }
.rd-keys summary:hover { color: var(--rdc-fg); }
.rd-keys__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--rdc-muted); }
.rd-keys__list li { display: flex; align-items: center; gap: 8px; }
.rd-keys__list li > span { display: inline-flex; gap: 3px; flex: none; }
.rd-keys__list kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 5px; background: var(--rdc-surface-2); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .08); color: var(--rdc-fg); font: 600 11px/1 inherit; }
@media (max-width: 420px) { .rd-opt--cards small { display: none; } }
