.reader-read.ds-btn{background:var(--color-text-primary,#111);color:#fff;border-color:var(--color-text-primary,#111);min-height:48px;padding:12px 28px;justify-content:center;display:inline-flex;align-items:center;gap:8px;line-height:20px}.reader-read .btn-icon{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex:0 0 20px;line-height:0;color:#fff}.reader-read .btn-icon .icon,.reader-read .btn-icon svg{display:block;width:18px;height:18px;color:inherit;fill:currentColor}.bd-description>.reader-read{display:flex;width:100%;margin-top:24px}.reader-file{pointer-events:none;display:none!important}.focus-actions>.reader-read{margin-bottom:8px}:is(.reading-review-btn,.reading-card-review){display:inline-flex;align-items:center;gap:8px;justify-content:center;line-height:20px;color:var(--color-text,#111)}:is(.reading-review-btn,.reading-card-review) .btn-icon{display:inline-flex;align-items:center;justify-content:center;line-height:0;color:inherit}:is(.reading-review-btn,.reading-card-review) .btn-icon :is(svg,.icon,.rm-icon){width:20px;height:20px;display:block;color:inherit;fill:currentColor}
#reader-local-view .reader-local-grid .card-copy :is(.reader-read,.reading-card-actions){display:none!important}
.bd-description>.bd-reading-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:10px;margin-top:24px}
.bd-description>.bd-reading-actions>:is(.reader-read,.reading-review-btn){flex:0 1 auto;width:auto;margin:0;height:auto;min-height:44px;max-height:none;padding:12px 20px;border:0;border-radius:var(--radius-pill,999px);font:500 14px/20px var(--font-body,system-ui);justify-content:center}
.bd-description>.bd-reading-actions>.reading-review-btn{background:var(--color-surface,#fff);color:var(--color-text,#111);box-shadow:var(--shadow-selected)}

/* Book detail cover: same circular Читать as reader-local cards. */
.ds-book-detail .bd-cover-wrap {
  --book-cover-inset: 10px;
}
.ds-book-detail .bd-cover-wrap .reader-cover-toolbar {
  z-index: 4;
}
.ds-book-detail .bd-cover-wrap .reader-cover-toolbar .reader-cover-action.ds-icon-btn > :is(svg, .icon, .rm-icon) {
  width: 16px;
  height: 16px;
}

.ds-book-detail .bd-cover-column > .bd-reading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
}
/* Tablet+: «Читать» and «Прогресс» share circular primary size with «Прочитано». */
.ds-book-detail .bd-cover-column > .bd-reading-actions > :is(.bd-reading-primary-btn, .bd-reading-finish-btn) {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round, 50%);
  overflow: visible;
  justify-content: center;
}
.ds-book-detail .bd-cover-column > .bd-reading-actions > .bd-reading-finish-btn {
  background: var(--color-surface, #fff);
  color: var(--color-text, #111);
  box-shadow: var(--shadow-selected);
}
.ds-book-detail .bd-cover-column > .bd-reading-actions > .bd-reading-finish-btn:hover:not(:disabled),
.ds-book-detail .bd-cover-column > .bd-reading-actions > .bd-reading-finish-btn:focus-visible {
  background: var(--color-surface, #fff);
  color: var(--color-text, #111);
  box-shadow: var(--shadow-control-hover, var(--shadow-selected));
}
.ds-book-detail .bd-cover-column > .bd-reading-actions > :is(.bd-reading-primary-btn, .bd-reading-finish-btn) .btn-icon {
  margin: 0;
}
.ds-book-detail .bd-cover-column > .bd-reading-actions > .bd-reading-primary-btn .btn-icon :is(svg, .icon, .rm-icon) {
  width: 18px;
  height: 18px;
  display: block;
  color: inherit;
  fill: currentColor;
}
.ds-book-detail .bd-cover-column > .bd-reading-actions > .reader-retry {
  flex: 1 1 auto;
  width: 100%;
}

@media (max-width: 767px) {
  html.catalog-responsive .ds-book-detail .bd-left-body .bd-reading-actions--phone {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 100%;
  }
  html.catalog-responsive .ds-book-detail .bd-left-body .bd-reading-actions--phone > :is(.reader-read, .reader-progress, .reading-review-btn, .reader-retry) {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    max-height: 44px;
  }
  html.catalog-responsive .ds-book-detail .bd-left-body .bd-reading-actions--phone > :is(.reader-read, .reader-progress).ds-btn {
    min-height: 44px;
    height: 44px;
    max-height: 44px;
    padding: 12px 16px;
  }
  html.catalog-responsive .ds-book-detail .bd-left-body .bd-reading-actions--phone:not(:has(.reading-review-btn)) > :is(.reader-read, .reader-progress).ds-btn,
  html.catalog-responsive .ds-book-detail .bd-left-body .bd-reading-actions--phone > :is(.reader-read, .reader-progress).ds-btn:only-child {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
  html.catalog-responsive .ds-book-detail .bd-left-body .bd-reading-actions--phone > .reading-review-btn {
    padding: 12px 16px;
  }
}

.reader-local-wide{display:none;flex-shrink:0}@media(min-width:1200px){.reader-local-wide{display:inline-flex}}
html.reader-open {overflow:hidden;overscroll-behavior:none}
#reader-overlay{position:fixed;inset:0;z-index:2000;background:var(--color-background)}
#reader-overlay iframe{width:100%;height:100%;border:0;display:block;background:inherit}
.reader-frame-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--color-background);
}
.reader-frame-loading .history-back {
  position: absolute;
  inset-block-start: max(12px, env(safe-area-inset-top));
  inset-inline-start: max(12px, env(safe-area-inset-left));
}

.reader-file{position:absolute;top:12px;left:12px;display:grid;place-items:center;width:var(--status-size-books);height:var(--status-size-books);border-radius:var(--radius-round);color:var(--color-status-icon);pointer-events:none}
.reader-file .icon{width:var(--status-icon-books);height:var(--status-icon-books)}

.reader-local-grid .medium-card>.reader-read{margin:12px;width:calc(100% - 24px);min-height:var(--control-height);padding:8px 16px}
/* Same grid rhythm as #library-view .books-grid. */
.reader-local-shell{min-width:0;padding-bottom:32px}
.reader-local-toolbar {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) auto;
  grid-template-areas:
    "tabs search search"
    "statuses statuses sort";
  align-items: center;
  gap: 20px 12px;
  margin: 0 0 16px;
}
.reader-local-tabs {
  grid-area: tabs;
  display: flex;
  align-items: baseline;
  gap: 24px;
}
#reader-local-view .reader-local-search {
  grid-area: search;
  justify-self: end;
  justify-content: flex-start;
  width: min(100%, 400px);
}
#reader-local-view .reader-local-search:not(:focus-within) {
  box-shadow: var(--shadow-selected);
}
#reader-local-view .reader-local-statuses{
  grid-area:statuses;
  display:flex;
  flex-wrap:nowrap;
  align-items:center;
  gap:8px;
  min-width:0;
  margin:0;
  /* Toolbar already sits in content inset — don't double edge-bleed padding. */
  width:auto;
  max-width:none;
  margin-inline:0;
  padding-inline:0;
  scroll-padding-inline:0;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-width:none;
}
#reader-local-view .reader-local-statuses::-webkit-scrollbar{display:none}
#reader-local-view .reader-local-tools{
  grid-area:sort;
  display:flex;
  align-items:center;
  gap:8px;
  flex:0 0 auto;
  min-width:0;
  max-width:100%;
  margin-left:auto;
}
#reader-local-view .reader-local-sort-wrap{
  display:flex;
  align-items:center;
  flex:0 1 auto;
  min-width:0;
  max-width:100%;
  margin-left:0;
}
#reader-local-view .reader-local-filters{
  flex:0 0 auto;
}
#reader-local-view .reader-local-sort-wrap .books-sort{
  max-width:min(100%,320px);
}
#reader-local-view #reader-local-advanced{
  z-index:90;
}
#reader-local-view .reader-local-sort-wrap .books-sort svg,
#reader-local-view .reader-local-sort-wrap .books-sort .rm-icon{
  width:16px;height:16px;flex-shrink:0;color:var(--color-text-secondary);
}
#reader-local-view .reader-local-sort-wrap select{
  min-width:0;width:auto;max-width:100%;
  font-size:var(--type-caption-size,12px);
  line-height:var(--type-caption-line,16px);
  color:inherit;
}
.reader-local-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(210px, 1fr));
  gap:24px 16px;
  align-items:start;
}
/* Desktop: same 8-up as catalog books. */
@media (min-width: 1200px) {
  .reader-local-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
  .reader-local-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "tabs tabs"
      "statuses sort";
  }
  #reader-local-view .reader-local-search {
    display: none;
  }
}
@media (max-width: 1199px) {
  .reader-local-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px 16px;
  }
}
@media (max-width: 767px) {
  .reader-local-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 8px;
  }
  .reader-local-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "tabs tabs"
      "statuses statuses"
      "search sort";
    row-gap: 16px;
  }
  .reader-local-tabs { gap: 16px; }
  #reader-local-view .reader-local-search { width: 100%; }
}
.reader-local-grid .medium-card.section-compact.four-up {
  display: flex;
  flex-direction: column;
  height: auto;
  min-width: 0;
  gap: 0;
  padding: 0;
  border: 0;
  background: var(--color-surface);
  border-radius: var(--radius-field);
}
.reader-local-grid .medium-card.section-compact.four-up .cover {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  flex: 0 0 auto;
  border-radius: var(--radius-field) var(--radius-field) 0 0;
  overflow: hidden;
}
.reader-local-grid .medium-card.section-compact.four-up .cover > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.reader-local-grid .medium-card.section-compact.four-up .card-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 10px 10px 12px;
}
.reader-local-grid .medium-card.section-compact.four-up .title {
  margin: 0;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}
.reader-local-grid .medium-card.section-compact.four-up .author {
  font-size: var(--type-caption-size);
}
.reader-local-grid .medium-card .reader-local-action { width: 100%; margin: 0 0 12px; flex: 0 0 auto; }
.reader-local-grid .medium-card .card-copy > .card-meta { margin-top: auto; padding-top: 12px; }
.reader-local-empty { grid-column: 1 / -1; }

.reading-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.reading-card-actions > :is(.reader-read, .reading-card-review, .reader-local-action) {
  flex: 1 1 auto;
  width: auto;
  min-height: 44px;
  height: auto;
  margin: 0;
  padding: 12px 20px;
  border: 0;
  border-radius: var(--radius-pill, 999px);
  font: 500 14px / 20px var(--font-body, system-ui);
}
.reading-card-actions > .reading-card-review {
  background: var(--color-surface, #fff);
  color: var(--color-text, #111);
  box-shadow: var(--shadow-selected);
}
.reader-local-grid .medium-card .reading-card-actions > .reader-local-action { width: auto; margin: 0; }

/* File availability is useful in the full catalog; device books already imply it. */
.reader-file { display: none; }
#library-view .reader-file { display: grid; }

/* Same 4px progress track as home, inset like the cover status controls. */
.reader-local-card .reader-local-progress { margin:4px var(--book-cover-inset,4px) 0; flex:0 0 auto; }
.reader-local-progress .progress-track { height:4px; border-radius:var(--radius-pill); background:var(--color-border); overflow:hidden; }
.reader-local-progress.is-empty .progress-track { background:rgba(20,18,18,.06); }
.reader-local-progress .progress-value { height:100%; border-radius:inherit; background:var(--reading-progress-fill, rgba(28, 28, 32, 0.76)); }

/* Only the read action in device-book cards uses the compact height. */
#reader-local-view .reader-local-grid .medium-card .reader-read.ds-btn { height: 32px; min-height: 32px; max-height: 32px; padding: 5px 16px; }

/* Cover ⋯ matches chrome glyph size/weight (Bold dots-three, 22px). */
:is(.medium-card, .book-entity-card) button.library-card-menu-toggle.ds-icon-btn > svg,
:is(.medium-card, .book-entity-card) button.library-card-menu-toggle.ds-icon-btn > svg.icon,
:is(.medium-card, .book-entity-card) button.library-card-menu-toggle.ds-icon-btn > svg.rm-icon {
  width: var(--ds-icon-glyph-size, 22px) !important;
  height: var(--ds-icon-glyph-size, 22px) !important;
  min-width: var(--ds-icon-glyph-size, 22px) !important;
  max-width: var(--ds-icon-glyph-size, 22px) !important;
  min-height: var(--ds-icon-glyph-size, 22px) !important;
  max-height: var(--ds-icon-glyph-size, 22px) !important;
  display: block !important;
  flex: 0 0 var(--ds-icon-glyph-size, 22px) !important;
  fill: currentColor !important;
}
