/* v125 mobile layout closure
   Give every page a fixed content rail and keep card metadata out of the action lane. */
@media (max-width: 719px) {
  html body main #library:not([hidden]) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: calc(50px + env(safe-area-inset-top, 0px)) minmax(0, 1fr) !important;
    height: 100dvh !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  html body main #library > .controls {
    display: none !important;
  }

  html body main #library > .mobile-workspace-heading {
    grid-column: 1 !important;
    grid-row: 1 !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: calc(50px + env(safe-area-inset-top, 0px)) !important;
    min-height: 0 !important;
    margin: 0 !important;
  }

  html body main #library > #showGrid {
    grid-column: 1 !important;
    grid-row: 2 !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    transform: none !important;
  }

  /* Home: title, air date, episode details and check action use separate lanes. */
  html body.view-home main #library > .mobile-workspace-heading {
    grid-template-columns: minmax(0, 1fr) !important;
    padding: env(safe-area-inset-top, 0px) 16px 0 !important;
  }

  html body.view-home main #library .mobile-workspace-title {
    grid-column: 1 !important;
  }

  html body.view-home main #library .mobile-workspace-actions,
  html body.view-home main #library .mobile-workspace-meta {
    display: none !important;
  }

  html body.view-home main #library #mobileWorkspaceTitle {
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.1 !important;
    letter-spacing: -.025em !important;
  }

  html body.view-home main #library > #showGrid {
    display: block !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 0 0 calc(58px + env(safe-area-inset-bottom, 0px)) !important;
  }

  html body.view-home main #library #showGrid > .show-card.timeline-card {
    display: grid !important;
    grid-template-columns: 84px minmax(0, 1fr) !important;
    column-gap: 16px !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 132px !important;
    margin: 0 !important;
    padding: 9px 16px !important;
    overflow: hidden !important;
    border: 0 !important;
    border-bottom: 1px solid var(--share-line, #e2e3e5) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .poster-frame,
  html body.view-home main #library #showGrid > .timeline-card .poster {
    grid-column: 1 !important;
    position: relative !important;
    inset: auto !important;
    display: block !important;
    width: 84px !important;
    height: 114px !important;
    min-width: 84px !important;
    min-height: 114px !important;
    margin: 0 !important;
    aspect-ratio: 2 / 3 !important;
    border-radius: 10px !important;
    transform: none !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .card-content {
    grid-column: 2 !important;
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 66px !important;
    grid-template-rows: 28px 34px 22px 20px !important;
    align-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 114px !important;
    min-height: 114px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .card-context {
    grid-column: 2 !important;
    grid-row: 1 !important;
    position: static !important;
    inset: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .card-context > span:first-child {
    display: none !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .card-air-date {
    display: block !important;
    max-width: 66px !important;
    overflow: hidden !important;
    color: var(--share-muted, #777a80) !important;
    font-size: 12px !important;
    line-height: 18px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .card-top {
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: center !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 8px 0 0 !important;
  }

  html body.view-home main #library #showGrid > .timeline-card h3 {
    display: block !important;
    max-width: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
    font-size: 18px !important;
    font-weight: 650 !important;
    line-height: 24px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .card-episode-row {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 66px !important;
    align-items: center !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .next-episode {
    grid-column: 1 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 8px 0 0 !important;
    font-size: 14px !important;
    line-height: 17px !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .episode-name {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    color: var(--share-muted, #777a80) !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    line-height: 17px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .card-quick-watch {
    grid-column: 2 !important;
    grid-row: 1 !important;
    position: static !important;
    inset: auto !important;
    justify-self: end !important;
    align-self: center !important;
    width: 40px !important;
    height: 40px !important;
    margin: 0 !important;
    transform: none !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .progress-row {
    grid-column: 1 !important;
    grid-row: 3 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    align-items: center !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 8px 0 0 !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .progress-track {
    width: 100% !important;
    min-width: 0 !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .progress-row > span {
    font-size: 11px !important;
    line-height: 16px !important;
    white-space: nowrap !important;
  }

  html body.view-home main #library #showGrid > .timeline-card .card-remaining {
    grid-column: 1 !important;
    grid-row: 4 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 8px 0 0 !important;
    overflow: hidden !important;
    font-size: 12px !important;
    line-height: 18px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* Database: no ghost row, pseudo spacer or translated poster is allowed. */
  html body.view-database main #library > .mobile-workspace-heading,
  html body.mobile-database-tab main #library > .mobile-workspace-heading {
    grid-template-columns: 50px minmax(0, 1fr) 100px !important;
  }

  html body.view-database main #library .mobile-workspace-actions,
  html body.mobile-database-tab main #library .mobile-workspace-actions {
    display: grid !important;
  }

  html body.view-database main #library > #showGrid,
  html body.mobile-database-tab main #library > #showGrid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    grid-auto-rows: max-content !important;
    place-content: start stretch !important;
    align-items: start !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    column-gap: 10px !important;
    row-gap: 14px !important;
    scroll-padding: 0 !important;
    padding: 8px 10px calc(62px + env(safe-area-inset-bottom, 0px)) !important;
  }

  html body.view-database main #library > #showGrid::before,
  html body.view-database main #library > #showGrid::after,
  html body.mobile-database-tab main #library > #showGrid::before,
  html body.mobile-database-tab main #library > #showGrid::after {
    display: none !important;
    content: none !important;
  }

  html body.view-database main #library > #showGrid > .database-card,
  html body.mobile-database-tab main #library > #showGrid > .database-card,
  html body.view-database main #library > #showGrid > .database-card .poster-frame,
  html body.mobile-database-tab main #library > #showGrid > .database-card .poster-frame,
  html body.view-database main #library > #showGrid > .database-card .poster,
  html body.mobile-database-tab main #library > #showGrid > .database-card .poster {
    inset: auto !important;
    margin-top: 0 !important;
    align-self: start !important;
    transform: none !important;
  }

  /* Profile: smaller data cells and a denser, shared action-row rhythm. */
  #profileDialog.mobile-tab-page .profile-summary,
  #profileDialog.mobile-tab-page .profile-overview,
  #profileDialog.mobile-tab-page .mobile-profile-hub,
  #profileDialog.mobile-tab-page .profile-activity-section {
    box-sizing: border-box !important;
    width: calc(100% - 32px) !important;
    max-width: none !important;
    margin-right: 16px !important;
    margin-left: 16px !important;
  }

  #profileDialog.mobile-tab-page .profile-summary {
    grid-template-columns: 56px minmax(0, 1fr) 40px !important;
    gap: 12px !important;
    min-height: 76px !important;
    margin-top: 8px !important;
    margin-bottom: 6px !important;
    padding: 10px 0 !important;
  }

  #profileDialog.mobile-tab-page .profile-summary img {
    width: 56px !important;
    height: 56px !important;
  }

  #profileDialog.mobile-tab-page .profile-summary strong {
    font-size: 19px !important;
    line-height: 1.2 !important;
  }

  #profileDialog.mobile-tab-page .profile-summary button {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
  }

  #profileDialog.mobile-tab-page .profile-overview {
    margin-bottom: 8px !important;
    padding: 0 !important;
  }

  #profileDialog.mobile-tab-page .profile-overview-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 1px solid var(--share-line, #e2e3e5) !important;
    border-radius: 12px !important;
    background: var(--share-soft, #f5f6f7) !important;
  }

  #profileDialog.mobile-tab-page .profile-overview-grid > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    min-height: 72px !important;
    padding: 10px 8px !important;
    border: 0 !important;
  }

  #profileDialog.mobile-tab-page .profile-overview-grid > div:nth-child(1),
  #profileDialog.mobile-tab-page .profile-overview-grid > div:nth-child(3) {
    border-right: 1px solid var(--share-line, #e2e3e5) !important;
  }

  #profileDialog.mobile-tab-page .profile-overview-grid > div:nth-child(-n+2) {
    border-bottom: 1px solid var(--share-line, #e2e3e5) !important;
  }

  #profileDialog.mobile-tab-page .profile-overview-grid strong {
    max-width: 100% !important;
    overflow: visible !important;
    font-size: 20px !important;
    font-weight: 650 !important;
    line-height: 24px !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
  }

  #profileDialog.mobile-tab-page .profile-overview-grid span {
    margin-top: 2px !important;
    font-size: 11px !important;
    line-height: 16px !important;
  }

  #profileDialog.mobile-tab-page .mobile-profile-hub {
    display: block !important;
    margin-bottom: 8px !important;
    padding: 0 !important;
  }

  #profileDialog.mobile-tab-page .mobile-profile-account,
  #profileDialog.mobile-tab-page .mobile-profile-actions {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  #profileDialog.mobile-tab-page .mobile-profile-account,
  #profileDialog.mobile-tab-page .mobile-profile-actions > button {
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr) !important;
    column-gap: 12px !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 60px !important;
    margin: 0 !important;
    padding: 0 4px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--share-line, #e2e3e5) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-align: left !important;
  }

  #profileDialog.mobile-tab-page .mobile-profile-account > .material-symbols-rounded:first-child,
  #profileDialog.mobile-tab-page .mobile-profile-actions > button > .material-symbols-rounded:first-child {
    display: grid !important;
    place-items: center !important;
    position: static !important;
    inset: auto !important;
    justify-self: center !important;
    width: 36px !important;
    height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 24px !important;
    transform: none !important;
  }

  #profileDialog.mobile-tab-page .mobile-profile-account > span:nth-child(2),
  #profileDialog.mobile-tab-page .mobile-profile-actions > button > span:nth-child(2) {
    min-width: 0 !important;
    margin: 0 !important;
  }

  #profileDialog.mobile-tab-page .mobile-profile-account b,
  #profileDialog.mobile-tab-page .mobile-profile-actions b {
    display: block !important;
    font-size: 16px !important;
    font-weight: 520 !important;
    line-height: 20px !important;
  }

  #profileDialog.mobile-tab-page .mobile-profile-account small,
  #profileDialog.mobile-tab-page .mobile-profile-actions small {
    display: block !important;
    margin-top: 1px !important;
    overflow: hidden !important;
    font-size: 11px !important;
    line-height: 15px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  #profileDialog.mobile-tab-page .mobile-profile-account > .material-symbols-rounded:last-child,
  #profileDialog.mobile-tab-page .mobile-profile-actions > button > .material-symbols-rounded:last-child {
    display: none !important;
  }
}
