/* Compact home sheet: overlays the reading carousel without moving books. */
.home-sheet {
  display: none;
}

@media (max-width: 1199px) {
  html.home-responsive body {
    --home-sheet-peek-ratio: 0.5;
    overflow: hidden;
    height: 100dvh;
    max-height: 100dvh;
    overscroll-behavior: none;
    touch-action: manipulation;
  }

  html.home-responsive {
    --home-sheet-section-gap: 28px;
    overflow: hidden;
    height: 100%;
  }

  html.home-responsive .app-shell,
  html.home-responsive .main-content {
    overflow: hidden;
    max-height: 100dvh;
    overscroll-behavior: none;
  }

  html.home-responsive #moment-view,
  html.home-responsive .moment-layout {
    overflow: visible;
    max-height: none;
    overscroll-behavior: none;
  }

  html.home-responsive .home-sheet:not([hidden]) {
    display: block;
    position: fixed;
    z-index: 25;
    left: 0;
    right: 0;
    top: var(--home-sheet-anchor-top, var(--home-sheet-top, max(240px, 42vh)));
    bottom: 0;
    height: auto;
    pointer-events: none;
    transition:
      top 0.48s cubic-bezier(0.22, 1, 0.36, 1),
      bottom 0.48s cubic-bezier(0.22, 1, 0.36, 1);
  }

  html.home-responsive
    .home-sheet[data-state="peek"]:not(.is-dragging) {
    top: var(--home-sheet-anchor-top, var(--home-sheet-top, max(240px, 42vh)));
    bottom: 0;
    height: auto;
  }

  html.home-responsive
    .home-sheet[data-state="open"]:not(.is-dragging) {
    top: var(--home-sheet-open-top, max(12px, env(safe-area-inset-top)));
    bottom: 0;
    height: auto;
  }

  html.home-responsive .home-sheet-surface {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: 28px 28px 0 0;
    background: var(--color-surface, #fff);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    transform: none;
    transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }

  html.home-responsive .home-sheet:is([data-state="open"], .is-closing)::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: auto;
    touch-action: none;
    background: transparent;
  }

  html.home-responsive .home-sheet.is-dragging,
  html.home-responsive .home-sheet.is-restoring {
    transition: none;
  }

  html.home-responsive .home-sheet.is-dragging .home-sheet-surface {
    transition: none;
  }

  html.home-responsive .home-sheet-handle-row {
    position: relative;
    min-height: 44px;
    box-sizing: border-box;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 16px 12px;
    touch-action: none;
    cursor: grab;
  }

  html.home-responsive .home-sheet-handle-row .profile-menu-slot {
    position: absolute;
    top: 12px;
    right: 16px;
    touch-action: manipulation;
    cursor: default;
  }

  /* Start lifting slightly above the visible sheet without covering the book actions. */
  html.home-responsive .home-sheet-handle-row::before {
    content: "";
    position: absolute;
    inset: -20px 0 auto;
    height: 20px;
    pointer-events: auto;
  }

  html.home-responsive .home-sheet-handle {
    width: 40px;
    height: 4px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.18);
    padding: 0;
  }

  html.home-responsive .home-sheet-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 8px 16px calc(104px + env(safe-area-inset-bottom));
    scrollbar-width: none;
    --edge-bleed-inset: 16px;
  }

  html.home-responsive .home-sheet-body::-webkit-scrollbar {
    display: none;
  }

  html.home-responsive .home-sheet[data-state="peek"] .home-sheet-body {
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
  }

  html.home-responsive .home-sheet-entries,
  html.home-responsive .home-sheet-moods {
    display: grid;
    align-items: stretch;
    gap: 8px;
    margin: 0 0 16px;
  }

  html.home-responsive .home-sheet-entries {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-top: 4px;
  }

  html.home-responsive .home-sheet-entries .home-sheet-entry {
    grid-column: span 2;
  }

  html.home-responsive.reader-library-off .home-sheet-entries .home-sheet-entry:nth-child(n + 4) {
    grid-column: span 3;
  }

  html.home-responsive .home-sheet-moods {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  html.home-responsive .home-sheet-moods {
    margin: 0;
  }

  html.home-responsive .home-sheet-entry,
  html.home-responsive .home-sheet-mood {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: auto;
    gap: 8px;
    margin: 0;
    padding: 10px 6px 12px;
    border: 0;
    border-radius: 18px;
    background: var(--color-surface, #fff);
    color: var(--color-text, #111);
    /* Same white surface + soft elevation as library book cards (.medium-card). */
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.07),
      0 1px 2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.15s ease;
    text-decoration: none;
    font: var(--weight-bold, 700) var(--type-caption-size, 12px) / 1.2 var(--font-body, system-ui);
    text-align: center;
  }

  html.home-responsive .home-sheet-entry-mark,
  html.home-responsive .home-sheet-mood-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: clamp(40px, 11vw, 64px);
    max-width: 100%;
    height: clamp(40px, 11vw, 64px);
    background: transparent;
  }

  html.home-responsive .home-sheet-entry-mark img,
  html.home-responsive .home-sheet-mood-mark img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
  }

  /* Tablet: icon left, label right — shorter cards. */
  @media (min-width: 768px) {
    html.home-responsive .home-sheet-entry,
    html.home-responsive .home-sheet-mood {
      flex-direction: row;
      align-items: center;
      justify-content: flex-start;
      gap: 10px;
      padding: 10px 12px;
      text-align: left;
    }

    html.home-responsive .home-sheet-entry-mark,
    html.home-responsive .home-sheet-mood-mark {
      width: 44px;
      height: 44px;
    }
  }

  html.home-responsive .home-sheet-entry:hover,
  html.home-responsive .home-sheet-mood:hover {
    box-shadow: var(--shadow-raised, 0 6px 20px rgba(0, 0, 0, 0.1));
  }

  html.home-responsive .home-sheet-section {
    margin: 0 0 var(--home-sheet-section-gap);
  }

  html.home-responsive .home-sheet-section-title {
    margin: 0 0 14px;
    font: var(--weight-semibold, 600) 18px / 1.3 var(--font-head, Georgia, serif);
    color: var(--color-text, #111);
  }

  html.home-responsive #home-sheet .home-reads-panel {
    display: block !important;
    margin: 0 0 var(--home-sheet-section-gap);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  html.home-responsive #home-sheet .home-reads-panel .home-section-head {
    margin: 0 0 12px;
    min-height: 0;
  }

  html.home-responsive #home-sheet .home-reads-panel .home-section-title h2 {
    margin: 0;
    font: var(--weight-semibold, 600) 18px / 1.3 var(--font-head, Georgia, serif);
  }

  html.home-responsive .home-sheet-rail {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  html.home-responsive .home-sheet-rail::-webkit-scrollbar {
    display: none;
  }

  html.home-responsive .home-sheet-book {
    flex: 0 0 96px;
    display: grid;
    gap: 8px;
    scroll-snap-align: start;
    color: inherit;
    text-decoration: none;
  }

  html.home-responsive .home-sheet-book-cover {
    width: 96px;
    height: 144px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-background, #f4f4f2);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  }

  html.home-responsive .home-sheet-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  html.home-responsive .home-sheet-book-title {
    font: var(--weight-medium, 500) var(--type-caption-size, 13px) / 1.25 var(--font-body, system-ui);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  html.home-responsive .home-sheet-series-list.home-sheet-rail {
    align-items: stretch;
  }

  html.home-responsive .home-sheet-series {
    flex: 0 0 auto;
    width: max-content;
    max-width: 100%;
    min-width: 88px;
    display: grid;
    gap: 10px;
    align-content: start;
    justify-items: stretch;
    padding: 12px;
    border-radius: 18px;
    background: var(--color-background, #f4f4f2);
    color: inherit;
    text-decoration: none;
    scroll-snap-align: start;
    box-sizing: border-box;
  }

  html.home-responsive .home-sheet-series-covers {
    display: flex;
    align-items: flex-end;
    width: max-content;
    min-height: 96px;
  }

  html.home-responsive .home-sheet-series-cover {
    flex: 0 0 64px;
    width: 64px;
    height: 96px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.85);
  }

  html.home-responsive .home-sheet-series-cover + .home-sheet-series-cover {
    margin-left: -22px;
  }

  html.home-responsive .home-sheet-series-cover:nth-child(1) {
    z-index: 3;
  }

  html.home-responsive .home-sheet-series-cover:nth-child(2) {
    z-index: 2;
  }

  html.home-responsive .home-sheet-series-cover:nth-child(3) {
    z-index: 1;
  }

  html.home-responsive .home-sheet-series-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  html.home-responsive .home-sheet-series-copy {
    width: 0;
    min-width: 100%;
  }

  html.home-responsive .home-sheet-series-name {
    margin: 0;
    font: var(--weight-medium, 500) var(--type-caption-size, 13px) / 1.25 var(--font-body, system-ui);
  }

  html.home-responsive .home-sheet-series-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  /* Compact: no glass topbar; logo / + / profile live in compact-home-panel. */
  html.home-responsive .app-shell > .topbar {
    display: none !important;
  }

  html.home-responsive .compact-home-panel:not([hidden]) {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: var(--color-background) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html.home-responsive .compact-home-brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    text-decoration: none;
    color: inherit;
  }

  html.home-responsive .compact-home-brand .brand-logo {
    width: 39.6px;
    height: 39.6px;
    display: block;
  }

  html.home-responsive .compact-home-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }

  html.home-responsive .compact-home-actions .profile-menu-slot {
    display: block;
  }

  html.home-responsive .compact-home-actions #profile-menu-trigger,
  html.home-responsive .compact-home-actions #capture-global-trigger,
  html.home-responsive .compact-home-actions #public-enter-home {
    display: inline-grid;
    place-items: center;
    padding: 0;
  }
  html.home-responsive .compact-home-actions #profile-menu-trigger[hidden] {
    display: none !important;
  }
  html.home-responsive .compact-home-actions #profile-menu-trigger > svg,
  html.home-responsive .compact-home-actions #capture-global-trigger > svg,
  html.home-responsive .compact-home-actions #public-enter-home > svg {
    display: block;
    margin: 0;
    width: var(--ds-icon-glyph-size, 22px);
    height: var(--ds-icon-glyph-size, 22px);
  }

  html.home-responsive .moment-layout > .home-reads-panel,
  html.home-responsive .home-calendar-panel {
    display: none !important;
  }

  html.home-responsive .app-shell {
    --home-inline-gutter: 24px;
    padding-top: 12px;
    padding-inline: var(--home-inline-gutter);
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  html.home-responsive .main-content {
    /* Keep the page gutter while clipping the carousel at the screen edge. */
    margin-inline: calc(0px - var(--home-inline-gutter));
    padding-inline: var(--home-inline-gutter);
  }

  html.home-responsive #mobile-reading-rail {
    display: none !important;
  }

  html.home-responsive body:has(#moment-view.is-active) #reading-carousel.moment-focus {
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  html.home-responsive #reading-carousel,
  html.home-responsive #reading-carousel.moment-focus,
  html.home-responsive body:has(#moment-view.is-active) #reading-carousel.moment-focus,
  html.home-responsive #reading-carousel.moment-focus:is(.theme-romantasy, .theme-hockey, .theme-nonfiction),
  html.home-responsive body:has(#moment-view.is-active) #reading-carousel.moment-focus:is(.theme-romantasy, .theme-hockey, .theme-nonfiction),
  html.home-responsive #reading-carousel > .reading-book-card,
  html.home-responsive #reading-carousel .home-hero-stage,
  html.home-responsive #reading-carousel .home-hero-viewport,
  html.home-responsive #reading-carousel .home-hero-track {
    background: transparent;
    box-shadow: none;
  }

  html.home-responsive #reading-carousel {
    position: relative;
    margin: 24px 0 0;
    touch-action: pan-y pinch-zoom;
    overscroll-behavior: none;
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    container-type: inline-size;
  }

  html.home-responsive #reading-carousel > .reading-book-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    justify-items: center;
    gap: 4px;
    width: 100%;
    max-width: min(720px, 100%);
    margin: 0 auto;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0;
    box-sizing: border-box;
    --home-hero-gap: 28px;
    /* ~15% smaller than 290×435 → 248×372 (multiples of 4 / 8). */
    --home-hero-center-width: min(248px, calc(0.9775 * (100cqi - 2 * var(--home-hero-gap)) / 2.15));
  }

  html.home-responsive #reading-carousel .carousel-toolbar,
  html.home-responsive #reading-carousel .carousel-rail,
  html.home-responsive #reading-carousel .carousel-count,
  html.home-responsive #reading-carousel .aftertaste,
  html.home-responsive #reading-carousel .focus-meta-item svg,
  html.home-responsive #reading-carousel #carousel-series-item {
    display: none !important;
  }

  html.home-responsive #reading-carousel .home-hero-stage {
    /* Only the covers span the viewport. */
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    justify-self: start;
    min-width: 0;
    position: relative;
    z-index: 2;
  }

  html.home-responsive #reading-carousel .home-hero-viewport {
    /* A transform carousel must not acquire native scrollLeft when a side button receives focus. */
    overflow: clip;
    padding: 0;
    margin: 0;
    pointer-events: none;
    touch-action: pan-y pinch-zoom;
  }

  html.home-responsive #reading-carousel .home-hero-track {
    display: flex;
    pointer-events: auto;
    touch-action: pan-y pinch-zoom;
  }

  html.home-responsive #reading-carousel .home-hero-slide {
    /* Reduce the visible gap by 30%, including the space from side scaling. */
    flex: 0 0 calc(var(--home-hero-center-width) * 0.87245 + var(--home-hero-gap) * 0.7);
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  html.home-responsive #reading-carousel .home-hero-cover {
    flex: 0 0 var(--home-hero-center-width);
    width: var(--home-hero-center-width);
    aspect-ratio: 2 / 3;
    padding: 0;
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-secondary, #f2f2f0);
    box-shadow: none;
    color: inherit;
    font: inherit;
    cursor: grab;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y pinch-zoom;
  }

  html.home-responsive #reading-carousel .home-hero-cover:active {
    cursor: grabbing;
  }

  html.home-responsive #reading-carousel .home-hero-cover:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
  }

  html.home-responsive #reading-carousel .home-hero-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
  }

  html.home-responsive #reading-carousel.has-hero-carousel #carousel-cover {
    display: none;
  }

  html.home-responsive #reading-carousel .focus-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 360px;
    height: auto !important;
    max-height: none !important;
    overflow: visible;
    text-align: center;
    grid-column: 1;
    grid-row: auto;
    margin-top: 0;
  }

  html.home-responsive #reading-carousel .reading-copy-stage {
    display: grid;
    width: 100%;
    justify-items: center;
  }

  html.home-responsive #reading-carousel .reading-copy-stage {
    transition: opacity 120ms ease;
  }

  html.home-responsive #reading-carousel.is-hero-moving .reading-copy-stage {
    opacity: 0.15;
  }

  /* Captions follow slide centers; the host follows the visible text height. */
  html.home-responsive #reading-carousel .reading-copy-stage.has-hero-captions {
    width: 100vw;
    max-width: none;
    position: relative;
    overflow: clip;
    opacity: 1;
    transition: none;
    isolation: isolate;
  }

  html.home-responsive #reading-carousel .has-hero-captions .reading-copy-face {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  html.home-responsive #reading-carousel .home-hero-caption {
    position: absolute;
    top: 0;
    justify-self: center;
    width: min(360px, calc(100vw - 32px));
    min-width: 0;
    opacity: 0;
    transition: none;
    pointer-events: none;
    will-change: transform, opacity;
  }

  html.home-responsive #reading-carousel .home-hero-caption .reading-card-open {
    pointer-events: inherit;
  }

  html.home-responsive #reading-carousel .reading-copy-face,
  html.home-responsive #reading-carousel .reading-copy-ghost {
    grid-area: 1 / 1;
    width: 100%;
  }

  html.home-responsive #reading-carousel .reading-copy-face {
    transition: opacity 440ms ease 100ms;
  }

  html.home-responsive #reading-carousel .reading-copy-face.is-incoming {
    opacity: 0;
    transition: none;
  }

  html.home-responsive #reading-carousel .reading-copy-ghost {
    pointer-events: none;
    transition: opacity 260ms ease;
  }

  html.home-responsive #reading-carousel .reading-copy-ghost.is-outgoing {
    opacity: 0;
  }

  html.home-responsive #reading-carousel .focus-title {
    font-size: clamp(22px, 5vw, 30px);
    line-height: 1.2;
    margin: 0;
    width: 100%;
    text-align: center;
  }

  html.home-responsive #reading-carousel .focus-title .reading-card-open {
    display: block;
    overflow: visible;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    line-height: 1.35;
  }

  html.home-responsive #reading-carousel .focus-meta-row {
    justify-content: center;
    margin-top: 2px;
  }

  html.home-responsive #reading-carousel .reading-progress {
    display: grid !important;
    grid-column: 1;
    grid-row: auto;
    width: var(--home-hero-center-width);
    max-width: 100%;
    min-height: 0;
    margin: 2px auto 0;
    justify-self: center;
    box-sizing: border-box;
    opacity: 1;
    transition: opacity 110ms ease;
  }

  html.home-responsive #reading-carousel.is-hero-moving .reading-progress {
    opacity: 0;
  }

  html.home-responsive #reading-carousel .reading-progress[hidden] {
    display: none !important;
    margin: 0;
    min-height: 0;
  }

  html.home-responsive #reading-carousel .progress-label {
    display: none;
  }

  html.home-responsive #reading-carousel .reading-controls {
    grid-column: 1;
    grid-row: auto;
    position: static;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 360px;
    margin: 18px auto 0;
    padding: 0;
    justify-self: center;
  }

  /* Above title: stretch to the hero book width. */
  html.home-responsive #reading-carousel .focus-copy > .focus-actions {
    grid-column: 1;
    grid-row: auto;
    position: static;
    display: flex;
    flex-wrap: nowrap;
    justify-content: stretch;
    align-items: stretch;
    gap: 8px;
    width: var(--home-hero-center-width);
    max-width: 100%;
    /* +6px from the progress line under the cover. Bottom is the gap above the title. */
    margin: 6px auto 6px;
    padding: 0;
    justify-self: center;
    order: -1;
  }

  html.home-responsive body #reading-carousel .focus-actions :is(.reader-read, .reader-progress) {
    flex: 1 1 auto;
    width: auto;
    min-width: 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);
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }

  html.home-responsive body #reading-carousel .focus-actions .reading-review-btn,
  html.home-responsive body #reading-carousel .focus-actions .ds-btn-surface.reading-review-btn,
  html.home-responsive body #reading-carousel .focus-actions .ds-btn.reading-review-btn {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 44px;
    max-height: none;
    padding: 12px 20px;
    margin: 0;
    border: 0;
    border-radius: var(--radius-pill, 999px);
    background: var(--color-surface, #fff) !important;
    color: var(--color-text, #111) !important;
    box-shadow: var(--shadow-selected) !important;
    font: 500 14px / 20px var(--font-body, system-ui);
  }

  html.home-responsive body #reading-carousel .focus-actions .reading-review-btn:hover:not(:disabled),
  html.home-responsive body #reading-carousel .focus-actions .ds-btn-surface.reading-review-btn:hover:not(:disabled),
  html.home-responsive body #reading-carousel .focus-actions .ds-btn.reading-review-btn:hover:not(:disabled) {
    background: var(--color-surface, #fff) !important;
    box-shadow: var(--shadow-control-hover, var(--shadow-selected)) !important;
  }
}

@media (max-width: 767px) {
  /* Phone: icon-only «Прочитано» only when «Читать» or «Прогресс» is also present. */
  html.home-responsive body #reading-carousel .focus-actions:has(:is(.reader-read, .reader-progress)) .reading-review-btn,
  html.home-responsive body #reading-carousel .focus-actions:has(:is(.reader-read, .reader-progress)) .ds-btn-surface.reading-review-btn,
  html.home-responsive body #reading-carousel .focus-actions:has(:is(.reader-read, .reader-progress)) .ds-btn.reading-review-btn {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    padding: 12px;
    gap: 0;
    font-size: 0;
    letter-spacing: 0;
  }
  html.home-responsive body #reading-carousel .focus-actions:has(:is(.reader-read, .reader-progress)) .reading-review-btn .btn-icon,
  html.home-responsive body #reading-carousel .focus-actions:has(:is(.reader-read, .reader-progress)) .ds-btn-surface.reading-review-btn .btn-icon,
  html.home-responsive body #reading-carousel .focus-actions:has(:is(.reader-read, .reader-progress)) .ds-btn.reading-review-btn .btn-icon {
    margin: 0;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  html.home-responsive #reading-carousel {
    margin-top: 12px;
  }

  html.home-responsive #reading-carousel > .reading-book-card {
    --home-hero-gap: 44px;
    /* ~15% smaller than 322×483 → 272×408 (multiples of 4 / 8). */
    --home-hero-center-width: min(272px, calc(0.9775 * (100cqi - 2 * var(--home-hero-gap)) / 2.05));
  }

  html.home-responsive #reading-carousel .reading-progress {
    width: var(--home-hero-center-width);
  }
}

@media (max-width: 1199px) and (prefers-reduced-motion: reduce) {
  html.home-responsive #reading-carousel .reading-copy-stage,
  html.home-responsive #reading-carousel .reading-progress,
  html.home-responsive #reading-carousel .reading-copy-face,
  html.home-responsive #reading-carousel .reading-copy-ghost {
    transition: none;
  }
}

@media (max-width: 1199px) {
  html.home-responsive .home-sheet-entry,
  html.home-responsive .home-sheet-mood { font-size: 14px; }
}

@media (max-width: 1199px) {
  html.home-responsive .home-sheet-entries { margin-bottom: var(--home-sheet-section-gap); }
  html.home-responsive #reading-carousel .focus-title .reading-card-open {
    display: block;
    max-height: none;
    overflow: visible;
    padding: 0.14em 0.16em 0.2em;
    box-sizing: border-box;
    line-height: 1.35;
    -webkit-line-clamp: unset;
  }
}
@media (max-width: 1199px) and (prefers-reduced-motion: reduce) {
  html.home-responsive .home-sheet,
  html.home-responsive .home-sheet-surface { transition: none !important; }
}

/* Home section headings share the smaller sans-serif hierarchy on every width. */
html.home-responsive #moment-view .home-section-title h2 {
  font: var(--weight-semibold, 600) 18px / 1.3 var(--font-head, Georgia, serif);
}

/* Section shortcuts: reference layout, three columns and two tall rows. */
@media (max-width: 1199px) {
  html.home-responsive .home-sheet-entries {
    gap: 10px;
  }

  html.home-responsive .home-sheet-entries .home-sheet-entry {
    box-sizing: border-box;
    min-width: 0;
    height: 160px;
    min-height: 160px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 18px;
    background: rgb(245, 245, 245);
    box-shadow: none;
    text-align: left;
  }

  html.home-responsive .home-sheet-entries .home-sheet-entry-mark {
    width: 80px;
    height: 80px;
  }

  html.home-responsive .home-sheet-entry-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
  }

  html.home-responsive .home-sheet-entry-title {
    font: 700 14px / 1.25 var(--font-body, system-ui);
    overflow-wrap: anywhere;
  }

  html.home-responsive .home-sheet-entry-description {
    font: 400 12px / 1.4 var(--font-body, system-ui);
    color: var(--color-text-secondary, #777);
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  html.home-responsive .home-sheet-entries { gap: 12px; }
  html.home-responsive .home-sheet-entries .home-sheet-entry {
    padding: 8px 16px;
    border-radius: 24px;
  }
  html.home-responsive .home-sheet-entries .home-sheet-entry-mark {
    width: 100px;
    height: 100px;
  }
  html.home-responsive .home-sheet-entry-title { font-size: 16px; }
  html.home-responsive .home-sheet-entry-description { font-size: 12px; }
}

@media (max-width: 1199px) {
  html.home-responsive .home-sheet-mood,
  html.home-responsive .home-sheet-mood:hover {
    background: rgb(245, 245, 245);
    box-shadow: none;
  }
}

@media (max-width: 400px) {
  html.home-responsive .home-sheet-entry-title { font-size: 12px; }
  html.home-responsive .home-sheet-entry-description { font-size: 10px; }
  html.home-responsive .home-sheet-entries .home-sheet-entry { padding-inline: 8px; }
}

@media (max-width: 1199px) {
  html.home-responsive .home-sheet-mood-mark img {
    transform: scale(0.85);
  }
}

@media (max-width: 1199px) {
  html.home-responsive .home-sheet-entries .home-sheet-entry {
    align-items: center;
    text-align: center;
  }
  html.home-responsive .home-sheet-entry-copy { align-items: center; }
}

@media (max-width: 767px) {
  html.home-responsive .app-shell {
    --home-inline-gutter: 12px;
  }

  html.home-responsive .home-sheet-entries .home-sheet-entry {
    height: 104px;
    min-height: 104px;
    padding-block: 4.8px;
    justify-content: center;
    gap: 8px;
  }
  html.home-responsive .home-sheet-entries .home-sheet-entry-mark {
    width: 56px;
    height: 56px;
  }
  html.home-responsive .home-sheet-entry-description { display: none; }
}

@media (min-width: 768px) and (max-width: 1199px) {
  html.home-responsive .home-sheet-entries .home-sheet-entry {
    height: 144px;
    min-height: 144px;
    justify-content: center;
    padding-block: 8px;
    gap: 4px;
  }
  html.home-responsive .home-sheet-entries .home-sheet-entry-mark {
    width: 80px;
    height: 80px;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  html.home-responsive .home-sheet-mood {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    gap: 8px;
    padding: 10px 6px 12px;
  }
  html.home-responsive .home-sheet-mood-mark {
    width: 57.2px;
    height: 57.2px;
  }
}

@media (max-width: 1199px) {
  html.home-responsive .home-sheet-handle-row {
    position: absolute;
    inset: 0 0 auto;
    z-index: 1;
    background: transparent;
  }
  html.home-responsive .home-sheet-body {
    padding-top: 52px;
    border-radius: 28px 28px 0 0;
  }
}

/* Mobile spacing: section tiles start 8px higher inside the sheet. */
@media (max-width: 767px) {
  html.home-responsive .home-sheet-body { padding-top: 44px; }
}
