/* Agreed Readmood surfaces and controls; responsive changes stop at 1199px. */
.author-detail-layout {
  grid-template-areas: "profile books";
  grid-template-rows: auto;
}
.author-series-panel {
  min-width: 0;
}
#author-quick-filters {
  margin-bottom: 16px;
}
#author-quick-filters .author-filters {
  background: var(--surface);
}
/* Shared label track uses the widest label; values share one left edge. */
.author-filters > .author-filter-desktop {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 16px;
  padding: 0;
}
.author-filters .col-detail-filter,
#author-quick-filters .col-detail-filter {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: start;
  gap: 16px;
  min-width: 0;
}
.author-filters .col-detail-filter-label {
  padding-top: 10px;
}
.author-filters .col-detail-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
:is(#author-quick-filters,.author-filters) .col-filter-chip.ds-btn-surface {
  display: inline-flex;
  gap: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-selected);
}
:is(#author-quick-filters,.author-filters) .col-filter-chip.ds-btn-surface.is-selected {
  background: var(--ink);
  color: var(--surface);
}
.compact-home-panel,
.compact-library-panel,
.compact-history-panel {
  display: none;
}
.compact-library-panel.catalog-tabs-fallback:not([hidden]) {
  display: block;
  margin-bottom: 12px;
}
@media (max-width: 1199px) {
  /* Logo/profile chrome: only on the home route. */
  html.home-responsive .compact-home-panel:not([hidden]),
  .compact-library-panel:not([hidden]),
  .compact-history-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: var(--radius-panel);
    background: var(--tabbar-surface);
    box-shadow: var(--tabbar-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .compact-home-panel {
    justify-content: space-between;
  }
  .compact-home-panel .compact-home-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }
  .compact-home-panel .profile-menu-slot {
    display: block;
  }
  .compact-home-panel #profile-menu-trigger,
  .compact-home-panel #capture-global-trigger,
  .compact-library-panel #profile-menu-trigger,
  .compact-library-panel #capture-global-trigger {
    display: inline-grid;
    place-items: center;
    padding: 0;
  }
  .compact-home-panel #profile-menu-trigger > svg,
  .compact-home-panel #capture-global-trigger > svg,
  .compact-library-panel #capture-global-trigger > svg {
    display: block;
    margin: 0;
    width: var(--ds-icon-glyph-size, 22px);
    height: var(--ds-icon-glyph-size, 22px);
  }
  /* Catalog section switcher → Nav tab canon; no page title «Каталог». */
  .compact-library-panel:has(.library-tabs:not([hidden])) .compact-page-title {
    display: none !important;
  }
  .compact-library-panel:has(.library-tabs:not([hidden])) .compact-header-actions:empty {
    display: none;
  }
  .compact-library-panel .library-tabs:not([hidden]) {
    display: flex;
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    margin: 0;
    border: 0;
    /* Tabs already sit inside page padding — no edge-bleed inset. */
    margin-inline: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
  }
  .compact-library-panel .library-tabs a,
  .compact-library-panel .library-tabs .library-tab {
    flex: 0 0 auto;
    width: auto;
    min-height: 0;
    padding: 0 0 6px;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--muted, var(--color-text-secondary));
    box-shadow: none;
    text-decoration: none;
    /* Same Literata 24 as tablet catalog tabs. */
    font-family: var(--font-head);
    font-size: 24px;
    line-height: 32px;
    font-weight: var(--weight-regular, 400);
    letter-spacing: var(--tracking-page, 0);
    transition: color var(--motion-tab) var(--motion-ease-out);
  }
  .compact-library-panel .library-tabs a[aria-current] {
    background: none;
    color: var(--ink, var(--color-text));
    font-weight: var(--weight-bold, 700);
    box-shadow: none;
  }
  .compact-library-panel .library-tabs a[aria-current]::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 20px;
    height: 2px;
    background: var(--ink, var(--color-text));
    transform: translateX(-50%);
    display: block;
  }
  #library-view .library-search {
    display: none;
  }
  .home-tabbar .home-dock-panel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  html.reader-library-off .home-tabbar .home-dock-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  html.reader-library-off .home-tabbar a[data-home-tab="reader-local"],
  html.reader-library-off #reader-local-entry {
    display: none !important;
  }
  .home-tabbar [aria-current="page"],
  .home-tabbar [aria-current="page"] svg {
    color: var(--ink);
  }
  .home-tabbar [aria-current="page"] {
    background: var(--surface);
    box-shadow: var(--shadow-selected);
  }
  /* home-responsive is only set on the home route; carousel pan rules live elsewhere. */
  #reading-carousel .carousel-arrow {
    display: none;
  }
  html
    :is(#author-view, #book-view, #series-view, #collections-view)
    .history-back {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-round);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-selected);
    font-size: 0;
  }
  .history-back span {
    display: none;
  }
  /* Same glyph box for close (X) and more (⋯) in compact entity headers. */
  html.catalog-responsive
    :is(#book-view, #author-view, #series-view, #collections-view)
    .compact-entity-header
    :is(.history-back, .bd-more > summary, .author-profile-menu, .ser-detail-menu)
    svg {
    width: var(--ds-icon-glyph-size, 22px);
    height: var(--ds-icon-glyph-size, 22px);
  }
  #capture-drawer,
  #capture-drawer.q-modal {
    inset: auto 0 0;
    width: 100%;
    height: auto;
    max-height: calc(var(--sheet-height, 100dvh) - 6px);
    bottom: var(--sheet-bottom, 0px);
    border: 0;
    border-radius: var(--radius-panel) var(--radius-panel) 0 0;
    display: flex;
    flex-direction: column;
    transform: none;
    animation: none;
    overflow: hidden;
  }
  #capture-drawer > .capture-drawer-head,
  #capture-drawer > .capture-drawer-footer,
  #capture-drawer.q-modal > .capture-drawer-head,
  #capture-drawer.q-modal > .capture-drawer-footer {
    flex: 0 0 auto;
  }
  #capture-drawer.q-modal.q-sheet-initial {
    height: var(--capture-sheet-initial, auto);
    min-height: var(--capture-sheet-initial, 0);
  }
  #capture-drawer.q-modal.q-sheet-max,
  #capture-drawer.q-modal.q-form-sheet,
  #capture-drawer.q-modal.q-detail-loading {
    top: max(env(safe-area-inset-top), var(--sheet-top, 6px));
    bottom: var(--sheet-bottom, 0px);
    height: auto;
    max-height: none;
  }
  #capture-drawer.q-modal.q-sheet-max #capture-body,
  #capture-drawer.q-modal.q-form-sheet #capture-body,
  #capture-drawer.q-modal.q-detail-loading #capture-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
  #capture-drawer[hidden] {
    display: none;
  }
  #capture-drawer .capture-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #capture-body {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #capture-drawer.q-modal:is(.q-chooser-mode, .q-search-mode) #capture-body:has(.q-search-row),
  #capture-drawer.q-modal.q-search-mode #capture-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #capture-drawer.q-modal:is(.q-chooser-mode, .q-search-mode) #capture-body > .q-sheet-scroll,
  #capture-drawer.q-modal.q-search-mode #capture-body > .q-sheet-scroll,
  #capture-drawer.q-modal:is(.q-chooser-mode, .q-search-mode) #capture-body:has(.q-search-row) > #q-results,
  #capture-drawer.q-modal.q-search-mode #capture-body > #q-results {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  #capture-drawer.q-modal:is(.q-chooser-mode, .q-search-mode) #capture-body:has(.q-search-row) > .q-search-row,
  #capture-drawer.q-modal.q-search-mode #capture-body > .q-search-row {
    flex-shrink: 0;
    margin-top: 0;
    order: -1;
    position: static;
    z-index: 2;
    background: var(--color-surface, #fff);
    padding-top: 0;
    padding-bottom: 8px;
    will-change: transform;
  }
  html.keyboard-open #capture-drawer.q-modal:is(.q-chooser-mode, .q-search-mode) #capture-body:has(.q-search-row) > .q-search-row,
  html.keyboard-open #capture-drawer.q-modal.q-search-mode #capture-body > .q-search-row {
    margin-top: auto;
    order: 0;
    position: relative;
    bottom: auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  html.capture-responsive.home-responsive .app-shell,
  html.capture-responsive.home-responsive .main-content,
  html.capture-responsive .app-shell,
  html.capture-responsive .main-content,
  html.capture-responsive .app-shell:has(#moment-view.is-active) {
    overflow: hidden;
    overscroll-behavior: none;
  }
  #capture-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    flex-shrink: 0;
  }
  #capture-footer .capture-primary {
    flex: 1 1 100%;
    width: 100%;
  }
}

@media (max-width: 767px) {
  #capture-drawer.q-modal,
  #capture-drawer.q-modal.q-sheet-initial,
  #capture-drawer.q-modal.q-sheet-max,
  #capture-drawer.q-modal.q-form-sheet,
  #capture-drawer.q-modal.q-detail-loading {
    top: max(env(safe-area-inset-top), var(--sheet-top, 6px));
    bottom: var(--sheet-bottom, 0px);
    height: auto;
    max-height: none;
    min-height: 0;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  html.keyboard-open #capture-drawer.q-modal:is(.q-chooser-mode, .q-search-mode) #capture-body:has(.q-search-row) > .q-search-row,
  html.keyboard-open #capture-drawer.q-modal.q-search-mode #capture-body > .q-search-row {
    margin-top: 0;
    order: -1;
    position: static;
    padding-top: 0;
    padding-bottom: 8px;
  }
}

.library-card-menu-toggle.ds-icon-btn--surface {
  background: var(--surface, var(--color-surface, #fff));
  color: var(--color-icon-control, #454545);
  box-shadow: var(--shadow-selected);
  border-radius: 50%;
}
.library-card-menu-toggle.ds-icon-btn--surface svg,
.library-card-menu-toggle.ds-icon-btn--surface img {
  filter: none;
}

:is(#author-quick-filters,.author-filters) .col-filter-chip.ds-btn-surface {
  max-width: 100%;
  height: auto;
  min-height: var(--control-height);
  white-space: normal;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
}
.author-filters .col-detail-filter-chips {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 1199px) {
  .entity-edit-sheet {
    width: 100%;
    max-width: 100%;
    margin: auto auto 0;
    padding: 0;
    max-height: min(90dvh, var(--sheet-height, 90dvh));
    bottom: var(--sheet-bottom, 0px);
    border: 0;
    border-radius: var(--radius-panel) var(--radius-panel) 0 0;
    background: var(--surface);
    color: var(--ink);
  }
  .entity-edit-sheet::backdrop {
    background: var(--color-backdrop);
  }
  .entity-edit-sheet[open] {
    display: flex;
    flex-direction: column;
  }
  .entity-edit-sheet .ser-form {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding: 0;
  }
  .entity-edit-sheet-head,
  .entity-edit-sheet-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
    gap: 12px;
    padding: 16px;
  }
  .entity-edit-sheet-head h2 {
    margin: 0;
    font-size: var(--type-panel-size);
  }
  .entity-edit-sheet-body {
    overflow-y: auto;
    min-height: 0;
    padding: 0 16px;
  }
  .entity-edit-sheet-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .entity-edit-sheet-footer button {
    flex: 1;
  }
  html:has(.entity-edit-sheet[open]) {
    overflow: hidden;
  }
}

.cp-body {
  display: contents;
}

@media (min-width: 1200px) {
  .author-detail-side #author-quick-filters {
    margin-top: 0;
    margin-bottom: 0;
    flex: 0 0 auto;
  }
}
#library-statuses [hidden] {
  display: none;
}

/* Author filters align with their owning panel; each group starts a new row. */
#author-quick-filters .author-filters {
  padding: 24px;
}
html #author-quick-filters .author-filter-desktop.col-detail-filters {
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  padding: 0;
  gap: 16px;
}
html #author-quick-filters .author-filter-desktop .col-detail-filter {
  flex-direction: column;
  align-items: flex-start;
}
@media (max-width: 1199px) {
  #author-quick-filters .author-filters {
    padding: 0;
  }
  .compact-home-panel:not([hidden]),
  .compact-library-panel:not([hidden]),
  .compact-history-panel {
    padding: 0;
    flex-wrap: wrap;
    justify-content: space-between;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .compact-page-title.search-page-title {
    flex: 0 0 auto;
    margin: 4px 0;
  }
  .compact-library-panel:not([hidden]) {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
  }
  .compact-library-panel .compact-page-title.search-page-title {
    margin: 0;
    display: flex;
    align-items: center;
    align-self: center;
  }
  .compact-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    max-width: 100%;
    min-width: 0;
  }
  .compact-library-panel .library-tabs:not([hidden]) {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    align-items: center;
    align-self: center;
    gap: 20px;
    margin: 0;
  }
  .compact-library-panel .library-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }
  .compact-history-panel:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 12px;
  }
  /* Tablet/mobile: no «История» title — period tabs sit on the left. */
  .compact-history-panel .compact-page-title.search-page-title {
    display: none !important;
  }
}
@media (max-width: 640px) {
  .compact-library-panel .compact-page-title {
    flex-basis: 100%;
  }
}

/* Surface button canon must not override the active filter state. */
html
  :is(#author-view, #series-view, #collections-view)
  .author-filters
  .col-filter-chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
  box-shadow: none;
}
html
  :is(#author-view, #series-view, #collections-view)
  .author-filters
  .col-filter-chip[aria-pressed="true"]
  .author-filter-count {
  color: inherit;
}

/* Center the real profile glyph, including when its header placement changes. */
#profile-menu-trigger.ds-icon-btn {
  display: grid;
  place-items: center;
  padding: 0;
}
#profile-menu-trigger > svg {
  display: block;
  margin: 0;
  width: var(--ds-icon-glyph-size, 22px);
  height: var(--ds-icon-glyph-size, 22px);
}
.compact-library-panel .compact-library-select {
  display: none;
}
@media (max-width: 767px) {
  .compact-library-panel:not([hidden]) {
    flex-wrap: nowrap;
    gap: 8px 12px;
  }
  .compact-library-panel .compact-page-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: clamp(24px, 7vw, 32px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .compact-library-panel .compact-header-actions {
    flex: 0 0 auto;
    gap: 8px;
    margin-left: auto;
  }
  .compact-library-panel .compact-header-actions #capture-global-trigger,
  .compact-library-panel .compact-header-actions .profile-menu-slot {
    flex: 0 0 auto;
  }
  /* Mobile: larger nav tabs take the title slot on the left. */
  .compact-library-panel .library-tabs:not([hidden]) {
    display: flex;
    flex: 1 1 auto;
    order: 0;
    min-width: 0;
    gap: 16px;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .compact-library-panel .library-tabs a,
  .compact-library-panel .library-tabs .library-tab {
    font-family: var(--font-head);
    font-size: 24px;
    line-height: 32px;
    font-weight: var(--weight-regular, 400);
  }
  .compact-library-panel .library-tabs a[aria-current],
  .compact-library-panel .library-tabs .library-tab[aria-current] {
    font-weight: var(--weight-bold, 700);
  }
  .compact-library-panel .library-tabs:not([hidden])::-webkit-scrollbar {
    display: none;
  }
  .compact-library-panel select#compact-library-section.compact-library-select.catalog-select:not([hidden]) {
    display: none !important;
  }
}

.ser-detail-side { min-width:0; display:grid; gap:16px; align-content:start; }

/* D32/D33/D35/D36: existing icon controls and author-filter geometry. */
/* Calendar and series open: keep surface+shadow over the body text-button reset. */
#moment-view #home-open-history.favorites-all,
.series-head-top .favorites-all,
#author-view .series-head-top .favorites-all{
  display:inline-grid;place-items:center;flex:0 0 var(--control-height-icon);
  box-sizing:border-box;
  width:var(--control-height-icon);min-width:var(--control-height-icon);max-width:var(--control-height-icon);
  height:var(--control-height-icon);min-height:var(--control-height-icon);max-height:var(--control-height-icon);
  aspect-ratio:1;padding:0;border:0;border-radius:50%;overflow:hidden;
  background:var(--color-surface);color:var(--color-text);
  box-shadow:var(--shadow-tag)
}
#moment-view #home-open-history.favorites-all svg,
.series-head-top .favorites-all svg,
#author-view .series-head-top .favorites-all svg{width:20px;height:20px}
.library-tabs .library-tab{
  display:inline-flex;align-items:center;justify-content:center;text-align:center;position:relative
}
:is(#author-quick-filters,.author-filters) .col-filter-chip.ds-btn-surface{width:auto;min-width:var(--control-height);height:auto;min-height:var(--control-height);padding:8px 12px;gap:8px;border-radius:var(--radius-pill);font:var(--weight-medium) var(--type-caption-size)/var(--type-caption-line) var(--font-body);background:var(--color-background);color:var(--color-text);box-shadow:none}
:is(#author-quick-filters,.author-filters) .col-filter-chip.ds-btn-surface:not(.is-selected):not([aria-pressed="true"]):hover{background:var(--color-border);color:var(--color-text)}
:is(#author-quick-filters,.author-filters) .col-filter-chip.ds-btn-surface:is(.is-selected,[aria-pressed="true"]){background:var(--color-text);color:var(--color-surface)}
.author-filters .author-filter-count{font-size:var(--type-caption-size);color:var(--color-icon-muted)}
:is(#author-quick-filters,.author-filters) .col-filter-chip.ds-btn-surface:is(.is-selected,[aria-pressed="true"]) .author-filter-count{color:var(--color-border)}
@media(max-width:1199px){
  .compact-page-title.search-page-title,.compact-library-panel .compact-page-title,.compact-history-panel .compact-page-title{font-size:var(--type-section-size);line-height:var(--type-section-line)}
}
@media(pointer:coarse) and (min-width:600px){
  #reading-carousel.moment-focus .book-placeholder{grid-row:1;align-self:stretch}
  #reading-carousel.moment-focus .focus-copy{grid-column:2;grid-row:1}
  #reading-carousel.moment-focus .focus-copy{display:flex;flex-direction:column;align-items:flex-start;align-self:stretch}
  #reading-carousel.moment-focus .focus-copy .focus-actions{position:static;display:flex;align-items:center;justify-content:flex-start;gap:12px;width:auto;margin-top:auto;padding-top:16px}
  .moment-focus .focus-actions :is(.reader-read,.reader-progress){width:auto;height:var(--control-height);min-height:var(--control-height);max-height:var(--control-height);margin:0;padding:8px 16px}
  #reading-carousel.moment-focus .focus-actions .reading-review-btn,
  #reading-carousel.moment-focus .focus-actions .ds-btn-surface.reading-review-btn,
  #reading-carousel.moment-focus .focus-actions .ds-btn.reading-review-btn{
    box-sizing:border-box;flex:0 1 auto;align-self:center;display:inline-flex;align-items:center;justify-content:center;
    width:auto;min-width:0;height:var(--control-height);min-height:var(--control-height);max-height:var(--control-height);
    padding:8px 16px;border:0;border-radius:var(--radius-pill);background:var(--color-surface);color:var(--color-text);box-shadow:var(--shadow-selected);gap:8px
  }
}

@media(min-width:1200px){
  html.catalog-responsive .compact-library-panel:not([hidden]){
    display:flex;align-items:center;gap:12px;min-width:0;margin-bottom:16px;
    padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;
    backdrop-filter:none;-webkit-backdrop-filter:none;
  }
  html.catalog-responsive .compact-library-panel .compact-page-title{
    margin:0;flex:0 0 auto;
    font:var(--weight-bold) var(--type-page-size)/var(--type-page-line) var(--font-head);
  }
  html.catalog-responsive .compact-library-panel .compact-header-actions{
    display:flex;flex:1 1 auto;min-width:0;align-items:center;justify-content:flex-end;gap:8px;
    margin-left:auto;padding-top:5px;
  }
  html.catalog-responsive .compact-library-panel .compact-library-select{display:none !important}
  html.catalog-responsive .compact-library-panel .library-tabs:not([hidden]){
    display:none;
  }
}

@media(max-width:1199px){
  .hist-responsive-title,.compact-history-panel .hist-title,.search-page-title{font-size:var(--type-section-size);line-height:var(--type-section-line)}
}

/* Personal book content: simultaneous sections on desktop, tabs on compact screens. */
.bd-personal-tabs{display:none}
.bd-personal-panels{display:grid;grid-template-columns:minmax(0,1fr) minmax(160px,.75fr);gap:24px;align-items:start}
.bd-personal-panel--experience{grid-column:1;grid-row:1}
.bd-personal-panel--recap{grid-column:1;grid-row:2}
.bd-personal-panel--posters{grid-column:2;grid-row:1 / 3}
.bd-personal-panel{min-width:0}
.bd-personal-panel[hidden]{display:none}
.bd-personal-panel-title{margin:0 0 12px;font:var(--weight-semibold) var(--type-body-size)/var(--type-body-line) var(--font-body)}
.bd-personal-panel--posters .bd-section-head,.bd-personal-panel--experience>.bd-personal-panel-title{display:none}
.bd-personal-empty{display:grid;place-items:center;min-height:96px;padding:24px 0}
.bd-recap-text{margin:0;white-space:pre-line;overflow-wrap:anywhere;font:var(--type-body-size)/var(--type-body-line) var(--font-body)}
@media(max-width:1199px){
  .bd-personal-tabs{display:flex;gap:24px;overflow-x:auto;margin-bottom:0}
  .bd-personal-tabs [role=tab]{flex:0 0 auto}
  .bd-personal-panels{display:block}
  .bd-personal-panel-title{display:none}
}
@media(min-width:768px) and (max-width:1199px){
  /* Compact home sheet owns tablet layout; keep these rules from forcing the old side card. */
  #reading-carousel.moment-focus .carousel-rail{display:none}
}
@media(min-width:1200px){
  #reading-carousel.moment-focus{height:auto;min-height:355px;max-height:none;box-sizing:border-box;overflow:visible}
  #reading-carousel.moment-focus .reading-book-card{
    height:auto;min-height:315px;max-height:none;
    grid-template-rows:auto auto;overflow:visible
  }
  #reading-carousel.moment-focus .book-placeholder{grid-column:1;grid-row:1}
  #reading-carousel.moment-focus .reading-progress{display:grid;grid-column:1;grid-row:2;margin-top:4px}
  #reading-carousel.moment-focus .reading-progress[hidden]{display:none}
  #reading-carousel.moment-focus .focus-copy{grid-column:2;grid-row:1;padding-bottom:52px}
  #reading-carousel.moment-focus .reading-controls{
    grid-column:2;grid-row:1;align-self:end;justify-content:space-between;width:100%;margin:0
  }
  #reading-carousel.moment-focus .carousel-rail{margin-left:auto}
  #reading-carousel.moment-focus .focus-copy{
    display:flex;flex-direction:column;align-self:stretch;min-width:0;min-height:0;overflow:visible
  }
  #reading-carousel.moment-focus .focus-title .reading-card-open{display:block;overflow:visible;line-height:1.35;max-height:none;-webkit-line-clamp:unset}
  #reading-carousel.moment-focus .aftertaste{
    flex:1 1 auto;min-height:0;width:100%;max-width:100%;
    margin:16px 0 0;max-height:none;
    -webkit-line-clamp:4;--reading-description-reserve:0px
  }
  #reading-carousel.moment-focus .reading-controls{
    flex-shrink:0;align-self:end;margin-top:0
  }
}

/* Catalog, reader and history: black/white pills.
   Collections kind tabs use the same second-level pills. */
:is(body, #library-view, #authors-view, #series-view, #collections-view, #reader-local-view, #history-view)
  :is(
    .books-statuses .books-chip,
    .authors-statuses .authors-chip,
    .collections-statuses .books-chip,
    .series-statuses .ds-segment-bar-item,
    .series-statuses .series-status-tab,
    .hist-section-tabs .hist-section-tab
  ) {
  appearance: none !important;
  -webkit-tap-highlight-color: transparent;
  min-height: var(--control-height-compact, 32px) !important;
  height: auto !important;
  padding: 6px 12px !important;
  gap: 6px;
  border: 0 !important;
  border-radius: var(--radius-pill) !important;
  background: var(--color-surface) !important;
  color: var(--color-text-secondary) !important;
  box-shadow: var(--shadow-selected) !important;
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  font-weight: var(--weight-regular, 400);
}
:is(body, #library-view, #authors-view, #series-view, #collections-view, #reader-local-view, #history-view)
  :is(
    .books-statuses .books-chip,
    .authors-statuses .authors-chip,
    .collections-statuses .books-chip,
    .series-statuses .ds-segment-bar-item,
    .series-statuses .series-status-tab,
    .hist-section-tabs .hist-section-tab
  ):is([aria-pressed="true"], .is-selected, .is-active),
:is(body, #library-view, #authors-view, #series-view, #collections-view, #reader-local-view, #history-view)
  :is(
    .books-statuses .books-chip,
    .authors-statuses .authors-chip,
    .collections-statuses .books-chip,
    .series-statuses .ds-segment-bar-item,
    .series-statuses .series-status-tab,
    .hist-section-tabs .hist-section-tab
  ):is([aria-pressed="true"], .is-selected, .is-active):hover:not(:disabled) {
  background: var(--color-text) !important;
  color: var(--color-surface) !important;
  box-shadow: none !important;
  font-weight: var(--weight-medium, 500);
  opacity: 1;
}
:is(body, #library-view, #authors-view, #series-view, #collections-view, #reader-local-view, #history-view)
  :is(
    .books-statuses .books-chip,
    .authors-statuses .authors-chip,
    .collections-statuses .books-chip,
    .series-statuses .ds-segment-bar-item,
    .series-statuses .series-status-tab,
    .hist-section-tabs .hist-section-tab
  )::after,
:is(body, #library-view, #authors-view, #series-view, #collections-view, #reader-local-view, #history-view)
  :is(
    .books-statuses .books-chip,
    .authors-statuses .authors-chip,
    .collections-statuses .books-chip,
    .series-statuses .ds-segment-bar-item,
    .series-statuses .series-status-tab,
    .hist-section-tabs .hist-section-tab
  )
  > span:first-child::after {
  content: none !important;
  display: none !important;
}
:is(body, #library-view, #authors-view, #series-view, #collections-view, #reader-local-view, #history-view)
  :is(
    .books-statuses .books-badge,
    .authors-statuses .authors-badge,
    .collections-statuses .books-badge,
    .series-statuses .ds-segment-bar-badge
  ) {
  color: inherit;
}
:is(#library-view .books-statuses, #authors-view .authors-statuses, #series-view .series-statuses, #collections-view .collections-statuses, #reader-local-view .reader-local-statuses) {
  gap: 8px;
}
#collections-view .collections-heading > h1 {
  display: none !important;
}
/* Д84: no blue flash on tap for status tabs and reading-stage chips; keyboard keeps DS ring. */
:is(#library-view, #authors-view, #history-view, #series-view, #collections-view, .ds-book-detail)
  :is(
    .books-chip,
    .authors-chip,
    .collections-chip,
    .hist-period-tab,
    .hist-section-tab,
    .library-tabs a,
    .bd-personal-tabs [role="tab"],
    .q-status-chip,
    .q-book-tab,
    .ds-segment-bar-item
  ) {
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
:is(#library-view, #authors-view, #history-view, #series-view, #collections-view, .ds-book-detail)
  :is(
    .books-chip,
    .authors-chip,
    .collections-chip,
    .hist-period-tab,
    .hist-section-tab,
    .library-tabs a,
    .bd-personal-tabs [role="tab"],
    .q-status-chip,
    .q-book-tab,
    .ds-segment-bar-item
  ):focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
:is(#library-view, #authors-view, #history-view, #series-view, #collections-view, .ds-book-detail)
  :is(
    .books-chip,
    .authors-chip,
    .collections-chip,
    .hist-period-tab,
    .hist-section-tab,
    .library-tabs a,
    .bd-personal-tabs [role="tab"],
    .q-status-chip,
    .q-book-tab,
    .ds-segment-bar-item
  ):focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
@media(max-width:1199px){
  .compact-library-panel:not([hidden]){margin-bottom:48px}
  :is(.compact-library-panel,.compact-history-panel) .compact-page-title.search-page-title{
    margin:0;font-size:var(--type-display-size);line-height:var(--type-display-line)
  }
}
@media (min-width: 768px) and (max-width: 1199px) {
  :is(.compact-library-panel,.compact-history-panel) .compact-page-title.search-page-title {
    font-size: calc(var(--type-display-size) + 4px);
    line-height: 1.12;
  }
}
@media(max-width:767px){
  :is(.compact-library-panel,.compact-history-panel) .compact-page-title.search-page-title{
    font-size:var(--type-panel-size);line-height:var(--type-panel-line)
  }
}
/* Acceptance D53: one shared personal surface; date belongs to the review. */
@media(max-width:1199px){
.ds-book-detail #book-drawer-personal .bd-experience-card{padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;gap:24px}
.ds-book-detail .bd-review-copy{flex:1;min-width:0}
.ds-book-detail .bd-review-copy .bd-read-date{margin:12px 0 0;white-space:normal}
.ds-book-detail .bd-personal-edit{justify-self:start;width:auto;padding:0}

  #bd-panel-fanfic .bd-section-head,#bd-panel-bonus .bd-section-head{display:none}
}

/* Compact screens retain touch scrolling without visible inner scrollbar tracks. */
@media (max-width:1199px) {
  html.catalog-responsive :is(.screen-view,dialog) * { scrollbar-width:none; }
  html.catalog-responsive :is(.screen-view,dialog) *::-webkit-scrollbar { display:none; width:0; height:0; }
}

/* D64: glass is limited to catalog/history heading rows; home keeps bare icons. */
@media(max-width:1199px){
  :is(.compact-library-panel,.compact-history-panel):not([hidden]){
    padding:16px;box-sizing:border-box;border:1px solid var(--color-surface);
    border-radius:var(--radius-panel);background:var(--tabbar-surface);
    -webkit-backdrop-filter:blur(var(--status-glass-blur));backdrop-filter:blur(var(--status-glass-blur));
    box-shadow:var(--tabbar-shadow);
  }
  .compact-home-panel:not([hidden]){
    padding:0;border:0;border-radius:0;background:transparent;
    box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none;
  }
  .bd-personal-tab-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:24px;flex-wrap:nowrap}
  .bd-personal-tab-head .bd-personal-tabs{margin:0;min-width:0;max-width:100%}
  .bd-personal-tab-head .bd-edit{flex:0 0 auto;margin-left:auto}
  .ds-book-detail #book-drawer-personal .bd-scale{padding:16px;border-radius:var(--radius-layer);background:var(--color-background)}
  .ds-book-detail #book-drawer-personal .bd-personal-main{
    padding:16px;border-radius:var(--radius-layer);background:var(--color-background);
    border:0;box-shadow:none
  }
}

/* Floating root glass: inset from viewport edges, compact inner padding. */
@media(max-width:1199px){
  html body:has(.compact-library-panel:not([hidden]),#history-view.is-active .compact-history-panel) .app-shell{padding-top:0}
  html body:has(:is(.compact-home-panel,.compact-library-panel):not([hidden]),#history-view.is-active .compact-history-panel) .main-content{padding-top:0}
  :is(.compact-library-panel,.compact-history-panel):not([hidden]){
    position:sticky;top:4px;z-index:25;
    margin:4px calc((100% - 100vw) / 2 + 8px) 0;width:auto;max-width:none;
    border-radius:var(--radius-panel);border-width:1px;padding:8px 12px;box-sizing:border-box;
  }
  .compact-home-panel:not([hidden]){
    position:static;top:auto;z-index:auto;
    margin:0 0 8px;width:auto;max-width:none;
    padding:0;border:0;border-radius:0;box-sizing:border-box;
  }
  .compact-library-panel:not([hidden]){
    padding-left:24px;padding-right:24px;
  }
}
@media(max-width:767px){
  .compact-library-panel:not([hidden]){
    padding-left:12px;padding-right:12px;
  }
}
@media(max-width:1199px){
  :is(.compact-library-panel,.compact-history-panel):not([hidden]){
    position:static;top:auto;
    margin-top:24px;margin-left:0;margin-right:0;
    width:100%;max-width:none;padding:0;
    border:0;border-radius:0;background:transparent;
    box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none;
  }
}

/* The tablet personal-content layout now applies on desktop too. */
.bd-personal-tabs{display:flex;gap:24px;overflow-x:auto;margin-bottom:0;align-items:center;min-width:0}
.bd-personal-tabs [role=tab]{flex:0 0 auto}
.ds-book-detail .bd-personal-tabs .nav-item,
.bd-personal-tabs .nav-item{
  font-family:var(--font-body);
  font-size:var(--type-section-size);
  line-height:var(--type-section-line);
  font-weight:var(--weight-medium, 500);
  letter-spacing:0;
}
.bd-personal-tabs .nav-item[aria-selected=true],
.bd-personal-tabs .nav-item.is-selected{
  background:transparent;
  color:var(--ink, var(--color-text));
  font-weight:var(--weight-semibold, 600);
}
.bd-personal-panels{display:block}
.bd-personal-panel-title{display:none}
.bd-personal-tab-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:24px;flex-wrap:nowrap}
.bd-personal-tab-head .bd-personal-tabs{margin:0;min-width:0;max-width:100%}
.bd-personal-tab-head .bd-edit{flex:0 0 auto;margin-left:auto}
.ds-book-detail .bd-personal{background:var(--surface);box-shadow:var(--shadow,var(--shadow-card,0 4px 16px rgba(0,0,0,0.04)))}
.ds-book-detail #book-drawer-personal .bd-experience-card{padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;gap:24px}
.ds-book-detail .bd-review-copy{flex:1;min-width:0}
.ds-book-detail .bd-review-copy .bd-read-date{margin:12px 0 0;white-space:normal}
.ds-book-detail #book-drawer-personal .bd-scale{padding:16px;border-radius:var(--radius-layer);background:var(--color-background)}
.ds-book-detail #book-drawer-personal .bd-personal-main{
  padding:16px;border-radius:var(--radius-layer);background:var(--color-background);
  border:0;box-shadow:none
}
#bd-panel-fanfic .bd-section-head,#bd-panel-bonus .bd-section-head{display:none}
@media (min-width: 1200px) {
  #author-detail-title {
    font-size: var(--type-display-size);
    line-height: var(--type-display-line);
  }
}
/* Compact: back-to-top matches dock search (68px) and shares its bottom edge. */
@media (max-width: 1199px) {
  .back-to-top {
    right: 16px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: 68px;
    min-width: 68px;
    max-width: 68px;
    height: 68px;
    min-height: 68px;
    max-height: 68px;
    border-radius: var(--radius-round);
  }
  .back-to-top svg {
    width: 26px;
    height: 26px;
  }
}
@media (max-width: 767px) {
  .back-to-top {
    right: 12px;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 12px);
  }
}

/* Book drawer: entity-nav + layout below header. */
/* Cover width by viewport — do not wait for html.catalog-responsive. */
@media (max-width: 1199px) {
  .ds-book-detail .bd-cover-column {
    width: 126px;
    max-width: 126px;
  }
  .ds-book-detail .bd-cover-wrap,
  .ds-book-detail #book-drawer-cover,
  .ds-book-detail .book-drawer-cover {
    width: 100%;
    max-width: 126px;
  }
}
@media (max-width: 767px) {
  .ds-book-detail .bd-cover-column {
    width: 108px;
    max-width: 108px;
  }
  .ds-book-detail .bd-cover-wrap,
  .ds-book-detail #book-drawer-cover,
  .ds-book-detail .book-drawer-cover {
    width: 108px;
    max-width: 108px;
    min-height: 0;
  }
}
@media (max-width: 1199px) {
  #book-drawer .book-detail-top.compact-entity-header:has(> .history-back) {
    display: grid !important;
  }
  #book-drawer .ds-book-detail .bd-left-body {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }
  #book-drawer .ds-book-detail .bd-cover-column {
    width: 126px;
    max-width: 126px;
    margin-inline: auto;
  }
  #book-drawer .ds-book-detail .bd-cover-wrap,
  #book-drawer .ds-book-detail #book-drawer-cover,
  #book-drawer .ds-book-detail .book-drawer-cover {
    width: 100%;
    max-width: 126px;
    margin-inline: auto;
  }
  #book-drawer .ds-book-detail .bd-cover-wrap img {
    width: 100%;
    height: 100%;
    display: block;
  }
  #book-drawer .ds-book-detail .bd-series .bd-section-head {
    align-items: flex-start;
  }
  #book-drawer
    .ds-book-detail
    .bd-series
    .bd-section-head
    button.bd-series-all,
  #book-drawer
    .ds-book-detail
    .bd-personal-tab-head
    button.bd-edit {
    display: inline-grid !important;
    place-items: center;
    flex: none !important;
    box-sizing: border-box;
    width: var(--ds-icon-size-sm) !important;
    min-width: var(--ds-icon-size-sm) !important;
    max-width: var(--ds-icon-size-sm) !important;
    height: var(--ds-icon-size-sm) !important;
    min-height: var(--ds-icon-size-sm) !important;
    max-height: var(--ds-icon-size-sm) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: var(--radius-round) !important;
    overflow: hidden;
    background: var(--color-background, #f5f5f5) !important;
    color: var(--color-text-secondary, #666) !important;
    box-shadow: none !important;
  }
  #book-drawer
    .ds-book-detail
    .bd-series
    .bd-section-head
    button.bd-series-all:hover:not(:disabled),
  #book-drawer
    .ds-book-detail
    .bd-series
    .bd-section-head
    button.bd-series-all:focus-visible,
  #book-drawer
    .ds-book-detail
    .bd-personal-tab-head
    button.bd-edit:hover:not(:disabled),
  #book-drawer
    .ds-book-detail
    .bd-personal-tab-head
    button.bd-edit:focus-visible {
    background: #ebebeb !important;
    color: var(--color-text, #111) !important;
    box-shadow: none !important;
    opacity: 1;
  }
  #book-drawer
    .ds-book-detail
    .bd-series
    .bd-section-head
    button.bd-series-all
    svg,
  #book-drawer
    .ds-book-detail
    .bd-personal-tab-head
    button.bd-edit
    :is(svg, .bd-icon) {
    width: var(--ds-icon-glyph-size-sm);
    height: var(--ds-icon-glyph-size-sm);
  }
}

/* Горизонтальный скролл: на предке задайте --edge-bleed-inset (или класс edge-bleed-scroll).
   В покое слева отступ; при прокрутке контент уходит до края; справа без лишнего padding-end.
   width + max-width:none — иначе max-width:100% у лент не даёт уйти в край шторки. */
@media (max-width: 1366px) {
  html.home-responsive .edge-bleed-scroll,
  html.home-responsive #home-sheet .home-sheet-rail,
  html.home-responsive #home-sheet .home-reads-panel .home-collections-rail,
  html.home-responsive #home-sheet .home-reads-panel .home-reads-side,
  html.home-responsive .home-reads-panel .home-collections-rail,
  html.home-responsive .home-reads-panel .home-reads-side {
    box-sizing: border-box;
    width: calc(100% + 2 * var(--edge-bleed-inset, 16px));
    max-width: none;
    contain: none;
    margin-inline: calc(-1 * var(--edge-bleed-inset, 16px));
    padding-inline-start: var(--edge-bleed-inset, 16px);
    padding-inline-end: 0;
    scroll-padding-inline-start: var(--edge-bleed-inset, 16px);
    scroll-padding-inline-end: 0;
  }
}
@media (max-width: 1199px) {
  html.catalog-responsive .edge-bleed-scroll {
    box-sizing: border-box;
    width: calc(100% + 2 * var(--edge-bleed-inset, 24px));
    max-width: none;
    margin-inline: calc(-1 * var(--edge-bleed-inset, 24px));
    padding-inline-start: var(--edge-bleed-inset, 24px);
    padding-inline-end: 0;
    scroll-padding-inline-start: var(--edge-bleed-inset, 24px);
    scroll-padding-inline-end: 0;
  }
  /* Section tabs in catalog header align to the content left edge. */
  html.catalog-responsive .compact-library-panel .library-tabs.edge-bleed-scroll {
    width: auto;
    max-width: none;
    margin-inline: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
  }
}

/* Desktop actions share the bottom baseline of the persistent cover progress. */
@media (min-width: 1200px) {
  #reading-carousel.moment-focus .reading-progress { visibility: visible; opacity: 1; }
  #reading-carousel.moment-focus .reading-controls {
    grid-row: 1 / 3;
    align-self: end;
    align-items: flex-end;
  }
  #reading-carousel.moment-focus .focus-copy { padding-bottom: 62px; }
  #reading-carousel.moment-focus .focus-actions :is(.reader-read, .reader-progress, .reading-review-btn) {
    height: auto;
    min-height: 44px;
    padding: 12px 20px;
    border-width: 0;
    font: 500 14px / 20px var(--font-body, system-ui);
  }
  #reading-carousel.moment-focus .carousel-rail { align-self: flex-end; }
}

/* Header search — same soft gray / white focus as Search and capture. */
body .topbar #global-search-trigger.search {
  background: var(--search-soft-background, var(--color-background, #F5F5F5));
  color: var(--color-icon-muted);
  gap: 14px;
}
body .topbar #global-search-trigger.search:hover {
  background: var(--search-soft-hover, #EEEEEE);
}
body .topbar #global-search-trigger.search:focus-within {
  background: var(--search-soft-focus, var(--color-surface, #fff));
  box-shadow: var(--search-soft-focus-shadow, 0 2px 8px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05));
}
body #global-search-trigger .header-search-input {
  color: var(--ink, var(--color-text));
  opacity: 1;
}
body #global-search-trigger .header-search-input::placeholder {
  color: var(--color-icon-muted);
  opacity: 1;
}
html.home-responsive #reading-carousel .carousel-rail {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}

/* Phone book header: cover | meta stack, then full-width description.
   Keep .bd-left-info as one cell — spanning the cover across meta/tags/collections
   rows used to stretch those rows to the cover height and leave huge gaps. */
@media (max-width: 767px) {
  html.catalog-responsive #book-drawer.ds-book-detail .bd-left-body {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 12px 16px;
    justify-items: stretch;
    align-items: start;
  }
  html.catalog-responsive #book-drawer.ds-book-detail .bd-left-copy {
    display: contents;
  }
  html.catalog-responsive #book-drawer.ds-book-detail .bd-cover-column {
    display: grid;
    grid-column: 1;
    grid-row: 1;
    width: 108px;
    min-width: 0;
    max-width: 108px;
    margin: 0;
    gap: 8px;
    align-self: start;
  }
  html.catalog-responsive #book-drawer.ds-book-detail .bd-cover-wrap {
    width: 108px;
    max-width: 108px;
    margin: 0;
  }
  html.catalog-responsive #book-drawer.ds-book-detail #book-drawer-cover {
    width: 108px;
    max-width: 108px;
    height: auto;
    min-height: 0;
    aspect-ratio: 2 / 3;
  }
  html.catalog-responsive #book-drawer.ds-book-detail .bd-cover-originals {
    width: 100%;
    min-width: 0;
  }
  html.catalog-responsive #book-drawer.ds-book-detail .bd-cover-originals p {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  html.catalog-responsive #book-drawer.ds-book-detail .bd-left-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    align-self: start;
  }
  html.catalog-responsive .ds-book-detail .bd-description {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
  }
  html.catalog-responsive .ds-book-detail .bd-left-body .bd-reading-actions--phone {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
  html.catalog-responsive .ds-book-detail .bd-left-body .bd-reading-actions--phone > :is(.reader-read, .reader-progress, .reading-review-btn, .reader-retry) {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    max-height: 44px;
    margin: 0;
    padding: 12px 16px;
    border-radius: var(--radius-pill, 999px);
    font: 500 14px/20px var(--font-body, system-ui);
  }
  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:not(:has(.reading-review-btn)) > :is(.reader-read, .reader-progress).ds-btn {
    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 {
    background: var(--color-surface, #fff);
    color: var(--color-text, #111);
    box-shadow: var(--shadow-selected);
    overflow: visible;
  }
  html.catalog-responsive .ds-book-detail .bd-left-body .bd-reading-actions--phone > .reader-retry {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
  html.catalog-responsive .ds-book-detail .bd-cover-column > .bd-reading-actions { display: none !important; }
  html.catalog-responsive .ds-book-detail .bd-left-body:has(.bd-reading-actions--phone) .bd-left-head {
    grid-column: 1 / -1;
    grid-row: 4;
  }
  html.catalog-responsive .ds-book-detail .bd-left-head {
    grid-column: 1 / -1;
    grid-row: 3;
  }
  html.catalog-responsive .ds-book-detail .bd-left {
    padding-top: 12px;
  }
}

/* Personal impression: compact, explicit spacing. */
.ds-book-detail #book-personal-section { padding-top: 16px; padding-bottom: 16px; }
.ds-book-detail .bd-personal-tab-head { margin-bottom: 4px; }
.ds-book-detail #book-drawer-personal { padding-top: 2px; }
.ds-book-detail #book-drawer-personal .bd-experience-card { gap: 20px; }
.ds-book-detail #book-drawer-personal .bd-scales { gap: 6px 8px; }

@media (max-width: 1199px) {
  html.catalog-responsive :is(#book-view, #series-view, #collections-view) .compact-entity-header :is(.bd-more > summary, .ser-detail-menu) {
    color: var(--color-text);
    background: var(--color-surface);
    box-shadow: var(--shadow-selected);
  }
  html.catalog-responsive #author-view .compact-entity-header .author-profile-menu {
    color: var(--surface, var(--color-surface));
    background: var(--ink, var(--color-text));
    box-shadow: var(--shadow-selected);
  }
}

@media (max-width: 1199px) {
  html.catalog-responsive :is(#book-view, #author-view, #series-view, #collections-view, #profile-view) .compact-entity-header > .history-back,
  html.catalog-responsive :is(#book-view, #series-view, #collections-view, #profile-view) .compact-entity-header :is(.bd-more > summary, .ser-detail-menu) {
    box-sizing: border-box;
    display: inline-grid;
    place-items: center;
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    margin: 0;
    padding: 8px;
    border: 0;
    border-radius: 50%;
    color: var(--color-text);
    background: var(--color-surface);
    box-shadow: var(--shadow-selected);
  }
  html.catalog-responsive #author-view .compact-entity-header .author-profile-menu {
    box-sizing: border-box;
    display: inline-grid;
    place-items: center;
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    margin: 0;
    padding: 8px;
    border: 0;
    border-radius: 50%;
    color: var(--surface, var(--color-surface));
    background: var(--ink, var(--color-text));
    box-shadow: var(--shadow-selected);
  }
  html.catalog-responsive :is(#book-view, #author-view, #series-view, #collections-view, #profile-view) .compact-entity-header > :is(.bd-more, #author-profile-actions, .ser-detail-actions) { width: 36px; min-width: 0; }
  html.catalog-responsive :is(#book-view, #author-view, #series-view, #collections-view) .compact-entity-header :is(.history-back, .bd-more > summary, .author-profile-menu, .ser-detail-menu) :is(img, svg) {
    width: var(--ds-icon-glyph-size, 22px);
    height: var(--ds-icon-glyph-size, 22px);
    filter: none;
    opacity: 1;
  }
}

.bd-tags-flow { display: contents; }
@media (max-width: 767px) {
  html.catalog-responsive #book-drawer.ds-book-detail .bd-tags-cloud {
    display: block;
  }
  .ds-book-detail .bd-tags-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
  .ds-book-detail .bd-tags-toggle {
    display: inline-grid;
    place-items: center;
    flex: none;
    min-width: 0;
    min-height: 0;
    padding: 0;
    box-sizing: border-box;
    border: 0;
    border-radius: 50%;
    background: #111;
    color: #fff;
  }
  .ds-book-detail .bd-tags-toggle svg,
  .ds-book-detail .bd-tags-toggle .rm-icon {
    width: 18px;
    height: 18px;
    color: #fff;
    fill: currentColor;
    stroke: none;
  }
  .ds-book-detail .bd-tags-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
}

/* Mobile dock sits 12px higher on every screen, including devices with a bottom safe area. */
@media (max-width: 767px) {
  .home-tabbar,
  html.home-responsive .home-tabbar {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 12px);
  }
}
